[Bf-blender-cvs] [e7f9614] blender2.8: Gawain: legacy OpenGL compatibility

Mike Erwin noreply at git.blender.org
Sun Aug 7 07:07:20 CEST 2016


Commit: e7f9614f079ff3d6c2dfdfa38aa51b3c556096cf
Author: Mike Erwin
Date:   Sat Aug 6 22:44:01 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBe7f9614f079ff3d6c2dfdfa38aa51b3c556096cf

Gawain: legacy OpenGL compatibility

Apple invented VAOs and exposes them via an extension in legacy GL.
Other platforms use at least GL 3.0 which has VAOs built in.

QUADS were removed from core profile but are useful for immediate-mode
drawing. We’ll have to implement our own QUAD drawing before switching
to core profile.

===================================================================

M	source/blender/gpu/intern/gpu_immediate.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 1510809..3d7250b 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -22,6 +22,17 @@
   #include <stdio.h>
 #endif
 
+#if defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT)
+  #undef glGenVertexArrays
+  #define glGenVertexArrays glGenVertexArraysAPPLE
+
+  #undef glDeleteVertexArrays
+  #define glDeleteVertexArrays glDeleteVertexArraysAPPLE
+
+  #undef glBindVertexArray
+  #define glBindVertexArray glBindVertexArrayAPPLE
+#endif
+
 void clear_VertexFormat(VertexFormat* format)
 	{
 	for (unsigned a = 0; a < format->attrib_ct; ++a)
@@ -95,7 +106,7 @@ static unsigned padding(unsigned offset, unsigned alignment)
 	}
 
 #if PACK_DEBUG
-void show_pack(a_idx, sz, pad)
+static void show_pack(a_idx, sz, pad)
 	{
 	const char c = 'A' + a_idx;
 	for (unsigned i = 0; i < pad; ++i)
@@ -241,6 +252,11 @@ void immBegin(GLenum primitive, unsigned vertex_ct)
 		case GL_TRIANGLES:
 			assert(vertex_ct % 3 == 0);
 			break;
+  #ifdef WITH_GL_PROFILE_COMPAT
+		case GL_QUADS:
+			assert(vertex_ct % 4 == 0);
+			break;
+  #endif
 		default:
 			assert(false);
 		}




More information about the Bf-blender-cvs mailing list