[Bf-blender-cvs] [c8d50ba] GPU_data_request: fix VAOs on Mac legacy context
Mike Erwin
noreply at git.blender.org
Thu Apr 2 02:37:39 CEST 2015
Commit: c8d50ba9e6fd17ff3d24d61ebffe6fb4e9afc335
Author: Mike Erwin
Date: Wed Apr 1 20:37:17 2015 -0400
Branches: GPU_data_request
https://developer.blender.org/rBc8d50ba9e6fd17ff3d24d61ebffe6fb4e9afc335
fix VAOs on Mac legacy context
GLEW gives us glBindVertexArray and friends but sets them to NULL,
since Apple uses GL_APPLE_vertex_array_object instead of
GL_ARB_vertex_array_object. The ARB version evolved from the APPLE
version and they’re used in exactly the same way, so I aliased them to
keep our VAO code simple.
===================================================================
M source/blender/gpu/GPU_glew.h
===================================================================
diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h
index 9421786..8196fec 100644
--- a/source/blender/gpu/GPU_glew.h
+++ b/source/blender/gpu/GPU_glew.h
@@ -34,4 +34,39 @@
#include "glew-mx.h"
+#ifdef __APPLE__
+/* Vertex Array Objects are part of OpenGL 3.0, or these extensions:
+ *
+ * GL_APPLE_vertex_array_object
+ * ^-- universally supported on Mac, widely supported on Linux (Mesa)
+ * GL_ARB_vertex_array_object
+ * ^-- widely supported on Windows & vendors' Linux drivers
+ *
+ * The ARB extension differs from the APPLE one in that client
+ * memory cannot be accessed through a non-zero vertex array object. It also
+ * differs in that vertex array objects are explicitly not sharable between
+ * contexts.
+ * (in other words, the ARB version of VAOs *must* use VBOs for vertex data)
+ *
+ * Called and used the exact same way, so alias to unify our VAO code.
+ *
+ * Not needed for GL >= 3.0
+ */
+
+# undef glIsVertexArray
+# define glIsVertexArray glIsVertexArrayAPPLE
+
+# undef glBindVertexArray
+# define glBindVertexArray glBindVertexArrayAPPLE
+
+# undef glGenVertexArrays
+# define glGenVertexArrays glGenVertexArraysAPPLE
+
+# undef glDeleteVertexArrays
+# define glDeleteVertexArrays glDeleteVertexArraysAPPLE
+
+/* TODO: a better workaround? */
+
+#endif /* __APPLE__ */
+
#endif /* __GPU_GLEW_H__ */
More information about the Bf-blender-cvs
mailing list