From: Neil Roberts Date: Fri, 21 Nov 2008 16:18:58 +0000 (+0000) Subject: Bug 1271 - mingw compiling failed: undefined reference to X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21617cc0f194ca60cf050db1e3d3b30455ffec8f;p=profile%2Fivi%2Fclutter.git Bug 1271 - mingw compiling failed: undefined reference to `_glDrawRangeElements@24' Resolve glDrawRangeElements with cogl_get_proc_address instead of calling it directly because functions defined in GL > 1.1 are not directly exported under Windows. * clutter/cogl/common/cogl-mesh.c: Use the function pointer from the context * clutter/cogl/gl/cogl-context.c (cogl_create_context): Initialise function pointer. * clutter/cogl/gl/cogl-context.h (CoglContext): Add a function pointer * clutter/cogl/gl/cogl-defines.h.in: Add a typedef for the function pointer. * clutter/cogl/gl/cogl.c (_cogl_features_init): Resolve glDrawRangeElements --- diff --git a/ChangeLog b/ChangeLog index 8bdc5aa..05ddbad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,29 @@ 2008-11-21 Neil Roberts + Bug 1271 - mingw compiling failed: undefined reference to + `_glDrawRangeElements@24' + + Resolve glDrawRangeElements with cogl_get_proc_address instead of + calling it directly because functions defined in GL > 1.1 are not + directly exported under Windows. + + * clutter/cogl/common/cogl-mesh.c: Use the function pointer from + the context + + * clutter/cogl/gl/cogl-context.c (cogl_create_context): Initialise + function pointer. + + * clutter/cogl/gl/cogl-context.h (CoglContext): Add a function + pointer + + * clutter/cogl/gl/cogl-defines.h.in: Add a typedef for the + function pointer. + + * clutter/cogl/gl/cogl.c (_cogl_features_init): Resolve + glDrawRangeElements + +2008-11-21 Neil Roberts + * tests/interactive/Makefile.am: * tests/conform/Makefile.am: Use $(EXEEXT) when specifying a dependency on an executable otherwise there won't be a rule to diff --git a/clutter/cogl/common/cogl-mesh.c b/clutter/cogl/common/cogl-mesh.c index 16a4db1..5b35463 100644 --- a/clutter/cogl/common/cogl-mesh.c +++ b/clutter/cogl/common/cogl-mesh.c @@ -196,11 +196,18 @@ #endif #ifndef HAVE_COGL_GL + /* GLES doesn't have glDrawRangeElements, so we simply pretend it does * but that it makes no use of the start, end constraints: */ #define glDrawRangeElements(mode, start, end, count, type, indices) \ glDrawElements (mode, count, type, indices) -#endif + +#else /* HAVE_COGL_GL */ + +#define glDrawRangeElements(mode, start, end, count, type, indices) \ + ctx->pf_glDrawRangeElements (mode, start, end, count, type, indices) + +#endif /* HAVE_COGL_GL */ static void _cogl_mesh_free (CoglMesh *mesh); @@ -1588,6 +1595,8 @@ cogl_mesh_draw_range_elements (CoglHandle handle, const GLvoid *indices) { CoglMesh *mesh; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); if (!cogl_is_mesh (handle)) return; diff --git a/clutter/cogl/gl/cogl-context.c b/clutter/cogl/gl/cogl-context.c index 0905162..a9240a1 100644 --- a/clutter/cogl/gl/cogl-context.c +++ b/clutter/cogl/gl/cogl-context.c @@ -114,6 +114,8 @@ cogl_create_context () _context->pf_glUniformMatrix2fvARB = NULL; _context->pf_glUniformMatrix3fvARB = NULL; _context->pf_glUniformMatrix4fvARB = NULL; + + _context->pf_glDrawRangeElements = NULL; /* Init OpenGL state */ GE( glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) ); diff --git a/clutter/cogl/gl/cogl-context.h b/clutter/cogl/gl/cogl-context.h index f68ef56..5ab5838 100644 --- a/clutter/cogl/gl/cogl-context.h +++ b/clutter/cogl/gl/cogl-context.h @@ -137,6 +137,8 @@ typedef struct COGL_PFNGLUNIFORMMATRIX2FVARBPROC pf_glUniformMatrix2fvARB; COGL_PFNGLUNIFORMMATRIX3FVARBPROC pf_glUniformMatrix3fvARB; COGL_PFNGLUNIFORMMATRIX4FVARBPROC pf_glUniformMatrix4fvARB; + + COGL_PFNGLDRAWRANGEELEMENTSPROC pf_glDrawRangeElements; } CoglContext; CoglContext * diff --git a/clutter/cogl/gl/cogl-defines.h.in b/clutter/cogl/gl/cogl-defines.h.in index 31c75bb..8658bed 100644 --- a/clutter/cogl/gl/cogl-defines.h.in +++ b/clutter/cogl/gl/cogl-defines.h.in @@ -1013,6 +1013,15 @@ typedef void GLboolean transpose, const GLfloat *value); +typedef void + (APIENTRYP COGL_PFNGLDRAWRANGEELEMENTSPROC) + (GLenum mode, + GLuint start, + GLuint end, + GLsizei count, + GLenum type, + const GLvoid *indices); + G_END_DECLS #endif diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c index 908a57c..1ce1a3c 100644 --- a/clutter/cogl/gl/cogl.c +++ b/clutter/cogl/gl/cogl.c @@ -1256,6 +1256,13 @@ _cogl_features_init () flags |= COGL_FEATURE_VBOS; } + /* This should always be available because it is defined in GL 1.2, + but we can't call it directly because under Windows functions > + 1.1 aren't exported */ + ctx->pf_glDrawRangeElements = + (COGL_PFNGLDRAWRANGEELEMENTSPROC) + cogl_get_proc_address ("glDrawRangeElements"); + /* Cache features */ ctx->feature_flags = flags; ctx->features_cached = TRUE;