Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-08-07 05:44:01 +0300
committerMike Erwin <significant.bit@gmail.com>2016-08-07 08:05:49 +0300
commite7f9614f079ff3d6c2dfdfa38aa51b3c556096cf (patch)
tree7e4a7bf9d497e65c427013842d4fd799702e4c0b /source/blender/gpu/intern/gpu_immediate.c
parent6b21d22c6084a1820f4d82afc59583924076655b (diff)
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.
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate.c')
-rw-r--r--source/blender/gpu/intern/gpu_immediate.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 15108093954..3d7250bf7e8 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);
}