فهرست منبع

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.

Alex Szpakowski 12 سال پیش
والد
کامیت
5bf78f891d
1فایلهای تغییر یافته به همراه19 افزوده شده و 2 حذف شده
  1. 19 2
      src/modules/graphics/opengl/OpenGL.cpp

+ 19 - 2
src/modules/graphics/opengl/OpenGL.cpp

@@ -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.