Commits

Alex Szpakowski  committed 1baf54d

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.

  • Participants
  • Parent commits 6bb5e8f

Comments (0)

Files changed (1)

File src/modules/graphics/opengl/OpenGL.cpp

 
 	contextInitialized = true;
 
+	// initialize multiple texture unit support for shaders, if available
 	textureUnits.clear();
-
-	// initialize multiple texture unit support for shaders, if available
 	if (Shader::isSupported())
 	{
 		GLint maxtextureunits;
 		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.