mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
Fixed OpenGL vertex buffer function usage (issue #489.)
The functions will be assigned to their core version counterparts if the extension version isn't supported but the core version is.
This commit is contained in:
@@ -46,9 +46,8 @@ void initializeContext()
|
||||
|
||||
contextInitialized = true;
|
||||
|
||||
textureUnits.clear();
|
||||
|
||||
// initialize multiple texture unit support for shaders, if available
|
||||
textureUnits.clear();
|
||||
if (Shader::isSupported())
|
||||
{
|
||||
GLint maxtextureunits;
|
||||
@@ -78,6 +77,24 @@ void initializeContext()
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &textureUnits[0]);
|
||||
}
|
||||
|
||||
// The functionality of the core and ARB VBOs are identical, so we can
|
||||
// assign the pointers of the core functions to the names of the ARB
|
||||
// functions, if the latter isn't supported but the former is.
|
||||
if (GLEE_VERSION_1_5 && !GLEE_ARB_vertex_buffer_object)
|
||||
{
|
||||
glBindBufferARB = (GLEEPFNGLBINDBUFFERARBPROC) glBindBuffer;
|
||||
glBufferDataARB = (GLEEPFNGLBUFFERDATAARBPROC) glBufferData;
|
||||
glBufferSubDataARB = (GLEEPFNGLBUFFERSUBDATAARBPROC) glBufferSubData;
|
||||
glDeleteBuffersARB = (GLEEPFNGLDELETEBUFFERSARBPROC) glDeleteBuffers;
|
||||
glGenBuffersARB = (GLEEPFNGLGENBUFFERSARBPROC) glGenBuffers;
|
||||
glGetBufferParameterivARB = (GLEEPFNGLGETBUFFERPARAMETERIVARBPROC) glGetBufferParameteriv;
|
||||
glGetBufferPointervARB = (GLEEPFNGLGETBUFFERPOINTERVARBPROC) glGetBufferPointerv;
|
||||
glGetBufferSubDataARB = (GLEEPFNGLGETBUFFERSUBDATAARBPROC) glGetBufferSubData;
|
||||
glIsBufferARB = (GLEEPFNGLISBUFFERARBPROC) glIsBuffer;
|
||||
glMapBufferARB = (GLEEPFNGLMAPBUFFERARBPROC) glMapBuffer;
|
||||
glUnmapBufferARB = (GLEEPFNGLUNMAPBUFFERARBPROC) glUnmapBuffer;
|
||||
}
|
||||
|
||||
// Set the 'default' texture (id 0) as a repeating white pixel.
|
||||
// Otherwise, texture2D inside a shader would return black when drawing graphics primitives,
|
||||
// which would create the need to use different "passthrough" shaders for untextured primitives vs images.
|
||||
|
||||
Reference in New Issue
Block a user