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.
This commit is contained in:
Neil Roberts 2009-02-16 12:42:08 +00:00
parent ff7bd05745
commit 43a5fef73d
8 changed files with 33 additions and 3 deletions

View File

@ -22,6 +22,11 @@
#include "../gles/cogl-gles2-wrapper.h" #include "../gles/cogl-gles2-wrapper.h"
#endif #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_free (CoglMaterial *tex);
static void _cogl_material_layer_free (CoglMaterialLayer *layer); static void _cogl_material_layer_free (CoglMaterialLayer *layer);

View File

@ -153,6 +153,8 @@
#define glDeleteBuffers ctx->pf_glDeleteBuffersARB #define glDeleteBuffers ctx->pf_glDeleteBuffersARB
#define glMapBuffer ctx->pf_glMapBufferARB #define glMapBuffer ctx->pf_glMapBufferARB
#define glUnmapBuffer ctx->pf_glUnmapBufferARB #define glUnmapBuffer ctx->pf_glUnmapBufferARB
#define glActiveTexture ctx->pf_glActiveTexture
#define glClientActiveTexture ctx->pf_glClientActiveTexture
#ifndef GL_ARRAY_BUFFER #ifndef GL_ARRAY_BUFFER
#define GL_ARRAY_BUFFER GL_ARRAY_BUFFER_ARB #define GL_ARRAY_BUFFER GL_ARRAY_BUFFER_ARB
#endif #endif

View File

@ -135,6 +135,8 @@ cogl_create_context ()
_context->pf_glUniformMatrix4fvARB = NULL; _context->pf_glUniformMatrix4fvARB = NULL;
_context->pf_glDrawRangeElements = NULL; _context->pf_glDrawRangeElements = NULL;
_context->pf_glActiveTexture = NULL;
_context->pf_glClientActiveTexture = NULL;
/* Initialise the clip stack */ /* Initialise the clip stack */
_cogl_clip_stack_state_init (); _cogl_clip_stack_state_init ();

View File

@ -162,6 +162,9 @@ typedef struct
COGL_PFNGLUNIFORMMATRIX4FVARBPROC pf_glUniformMatrix4fvARB; COGL_PFNGLUNIFORMMATRIX4FVARBPROC pf_glUniformMatrix4fvARB;
COGL_PFNGLDRAWRANGEELEMENTSPROC pf_glDrawRangeElements; COGL_PFNGLDRAWRANGEELEMENTSPROC pf_glDrawRangeElements;
COGL_PFNGLACTIVETEXTUREPROC pf_glActiveTexture;
COGL_PFNGLCLIENTACTIVETEXTUREPROC pf_glClientActiveTexture;
} CoglContext; } CoglContext;
CoglContext * CoglContext *

View File

@ -1026,6 +1026,14 @@ typedef void
GLenum type, GLenum type,
const GLvoid *indices); const GLvoid *indices);
typedef void
(APIENTRYP COGL_PFNGLACTIVETEXTUREPROC)
(GLenum texture);
typedef void
(APIENTRYP COGL_PFNGLCLIENTACTIVETEXTUREPROC)
(GLenum texture);
G_END_DECLS G_END_DECLS
#endif #endif

View File

@ -54,6 +54,8 @@
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
#define glDrawRangeElements ctx->pf_glDrawRangeElements #define glDrawRangeElements ctx->pf_glDrawRangeElements
#define glActiveTexture ctx->pf_glActiveTexture
#define glClientActiveTexture ctx->pf_glClientActiveTexture
#else #else

View File

@ -1083,12 +1083,18 @@ _cogl_features_init ()
flags |= COGL_FEATURE_VBOS; flags |= COGL_FEATURE_VBOS;
} }
/* This should always be available because it is defined in GL 1.2, /* These should always be available because they are defined in GL
but we can't call it directly because under Windows functions > 1.2, but we can't call it directly because under Windows
1.1 aren't exported */ functions > 1.1 aren't exported */
ctx->pf_glDrawRangeElements = ctx->pf_glDrawRangeElements =
(COGL_PFNGLDRAWRANGEELEMENTSPROC) (COGL_PFNGLDRAWRANGEELEMENTSPROC)
cogl_get_proc_address ("glDrawRangeElements"); 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 */ /* Cache features */
ctx->feature_flags = flags; ctx->feature_flags = flags;

View File

@ -56,6 +56,8 @@
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
#define glDrawRangeElements ctx->pf_glDrawRangeElements #define glDrawRangeElements ctx->pf_glDrawRangeElements
#define glActiveTexture ctx->pf_glActiveTexture
#define glClientActiveTexture ctx->pf_glClientActiveTexture
#else #else