Bug 1271 - mingw compiling failed: undefined reference to
authorNeil Roberts <neil@openedhand.com>
Fri, 21 Nov 2008 16:18:58 +0000 (16:18 +0000)
committerNeil Roberts <neil@openedhand.com>
Fri, 21 Nov 2008 16:18:58 +0000 (16:18 +0000)
`_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

ChangeLog
clutter/cogl/common/cogl-mesh.c
clutter/cogl/gl/cogl-context.c
clutter/cogl/gl/cogl-context.h
clutter/cogl/gl/cogl-defines.h.in
clutter/cogl/gl/cogl.c

index 8bdc5aa..05ddbad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2008-11-21  Neil Roberts  <neil@linux.intel.com>
 
+       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  <neil@linux.intel.com>
+
        * 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
index 16a4db1..5b35463 100644 (file)
 #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;
index 0905162..a9240a1 100644 (file)
@@ -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) );
index f68ef56..5ab5838 100644 (file)
@@ -137,6 +137,8 @@ typedef struct
   COGL_PFNGLUNIFORMMATRIX2FVARBPROC                pf_glUniformMatrix2fvARB;
   COGL_PFNGLUNIFORMMATRIX3FVARBPROC                pf_glUniformMatrix3fvARB;
   COGL_PFNGLUNIFORMMATRIX4FVARBPROC                pf_glUniformMatrix4fvARB;
+
+  COGL_PFNGLDRAWRANGEELEMENTSPROC                  pf_glDrawRangeElements;
 } CoglContext;
 
 CoglContext *
index 31c75bb..8658bed 100644 (file)
@@ -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
index 908a57c..1ce1a3c 100644 (file)
@@ -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;