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
This commit is contained in:
Neil Roberts 2008-11-21 16:18:58 +00:00
parent fccc087959
commit 21617cc0f1
6 changed files with 54 additions and 1 deletions

View File

@ -1,3 +1,27 @@
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:

View File

@ -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;

View 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) );

View 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 *

View 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

View 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;