From 9e10dc402f4402f65d9ecfc0714b4a00c8bccf8e Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 16 Feb 2009 12:42:08 +0000 Subject: [PATCH] Call glActiveTexture and glClientActiveTexture through cogl_get_proc_address All GL functions that are defined in a version later than 1.1 need to be called through cogl_get_proc_address because the Windows GL DLL does not export them to directly link against. --- clutter/cogl/common/cogl-material.c | 5 +++++ clutter/cogl/common/cogl-vertex-buffer.c | 2 ++ clutter/cogl/gl/cogl-context.c | 2 ++ clutter/cogl/gl/cogl-context.h | 3 +++ clutter/cogl/gl/cogl-defines.h.in | 8 ++++++++ clutter/cogl/gl/cogl-texture.c | 2 ++ clutter/cogl/gl/cogl.c | 12 +++++++++--- clutter/cogl/gles/cogl-texture.c | 2 ++ 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/clutter/cogl/common/cogl-material.c b/clutter/cogl/common/cogl-material.c index 8f9ead31c..636b3d349 100644 --- a/clutter/cogl/common/cogl-material.c +++ b/clutter/cogl/common/cogl-material.c @@ -22,6 +22,11 @@ #include "../gles/cogl-gles2-wrapper.h" #endif +#ifdef HAVE_COGL_GL +#define glActiveTexture ctx->pf_glActiveTexture +#define glClientActiveTexture ctx->pf_glClientActiveTexture +#endif + static void _cogl_material_free (CoglMaterial *tex); static void _cogl_material_layer_free (CoglMaterialLayer *layer); diff --git a/clutter/cogl/common/cogl-vertex-buffer.c b/clutter/cogl/common/cogl-vertex-buffer.c index a1ee11f91..bd2443b94 100644 --- a/clutter/cogl/common/cogl-vertex-buffer.c +++ b/clutter/cogl/common/cogl-vertex-buffer.c @@ -153,6 +153,8 @@ #define glDeleteBuffers ctx->pf_glDeleteBuffersARB #define glMapBuffer ctx->pf_glMapBufferARB #define glUnmapBuffer ctx->pf_glUnmapBufferARB +#define glActiveTexture ctx->pf_glActiveTexture +#define glClientActiveTexture ctx->pf_glClientActiveTexture #ifndef GL_ARRAY_BUFFER #define GL_ARRAY_BUFFER GL_ARRAY_BUFFER_ARB #endif diff --git a/clutter/cogl/gl/cogl-context.c b/clutter/cogl/gl/cogl-context.c index fc2728921..759243886 100644 --- a/clutter/cogl/gl/cogl-context.c +++ b/clutter/cogl/gl/cogl-context.c @@ -135,6 +135,8 @@ cogl_create_context () _context->pf_glUniformMatrix4fvARB = NULL; _context->pf_glDrawRangeElements = NULL; + _context->pf_glActiveTexture = NULL; + _context->pf_glClientActiveTexture = NULL; /* Initialise the clip stack */ _cogl_clip_stack_state_init (); diff --git a/clutter/cogl/gl/cogl-context.h b/clutter/cogl/gl/cogl-context.h index ec3942988..bcffdfa19 100644 --- a/clutter/cogl/gl/cogl-context.h +++ b/clutter/cogl/gl/cogl-context.h @@ -162,6 +162,9 @@ typedef struct COGL_PFNGLUNIFORMMATRIX4FVARBPROC pf_glUniformMatrix4fvARB; COGL_PFNGLDRAWRANGEELEMENTSPROC pf_glDrawRangeElements; + + COGL_PFNGLACTIVETEXTUREPROC pf_glActiveTexture; + COGL_PFNGLCLIENTACTIVETEXTUREPROC pf_glClientActiveTexture; } CoglContext; CoglContext * diff --git a/clutter/cogl/gl/cogl-defines.h.in b/clutter/cogl/gl/cogl-defines.h.in index b23cbc681..f9a3bced6 100644 --- a/clutter/cogl/gl/cogl-defines.h.in +++ b/clutter/cogl/gl/cogl-defines.h.in @@ -1026,6 +1026,14 @@ typedef void GLenum type, const GLvoid *indices); +typedef void + (APIENTRYP COGL_PFNGLACTIVETEXTUREPROC) + (GLenum texture); + +typedef void + (APIENTRYP COGL_PFNGLCLIENTACTIVETEXTUREPROC) + (GLenum texture); + G_END_DECLS #endif diff --git a/clutter/cogl/gl/cogl-texture.c b/clutter/cogl/gl/cogl-texture.c index 7f266913e..a45cede8b 100644 --- a/clutter/cogl/gl/cogl-texture.c +++ b/clutter/cogl/gl/cogl-texture.c @@ -54,6 +54,8 @@ #ifdef HAVE_COGL_GL #define glDrawRangeElements ctx->pf_glDrawRangeElements +#define glActiveTexture ctx->pf_glActiveTexture +#define glClientActiveTexture ctx->pf_glClientActiveTexture #else diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c index b42b6ae42..a65728faa 100644 --- a/clutter/cogl/gl/cogl.c +++ b/clutter/cogl/gl/cogl.c @@ -1083,12 +1083,18 @@ _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 */ + /* These should always be available because they are 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"); + ctx->pf_glActiveTexture = + (COGL_PFNGLACTIVETEXTUREPROC) + cogl_get_proc_address ("glActiveTexture"); + ctx->pf_glClientActiveTexture = + (COGL_PFNGLCLIENTACTIVETEXTUREPROC) + cogl_get_proc_address ("glClientActiveTexture"); /* Cache features */ ctx->feature_flags = flags; diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c index f0bfba43d..dcf7dc6fa 100644 --- a/clutter/cogl/gles/cogl-texture.c +++ b/clutter/cogl/gles/cogl-texture.c @@ -56,6 +56,8 @@ #ifdef HAVE_COGL_GL #define glDrawRangeElements ctx->pf_glDrawRangeElements +#define glActiveTexture ctx->pf_glActiveTexture +#define glClientActiveTexture ctx->pf_glClientActiveTexture #else