Use all core GL functions through indirect pointers

cogl-ext-functions.h now contains definitions for all of the core GL
and GLES functions that we would normally link to directly. All of the
code has changed to access them through the cogl context pointer. The
GE macro now takes an extra parameter to specify the context because
the macro itself needs to make GL calls but various points in the Cogl
source use different names for the context variable.
This commit is contained in:
Neil Roberts
2011-07-06 21:51:00 +01:00
parent dae02a99a5
commit 2b119b07da
31 changed files with 989 additions and 828 deletions

View File

@ -66,10 +66,10 @@ typedef struct _CoglBoxedValue
const char *
cogl_gl_error_to_string (GLenum error_code);
#define GE(x) G_STMT_START { \
#define GE(ctx, x) G_STMT_START { \
GLenum __err; \
(x); \
while ((__err = glGetError ()) != GL_NO_ERROR) \
(ctx)->x; \
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
{ \
g_warning ("%s: GL error (%d): %s\n", \
G_STRLOC, \
@ -77,10 +77,10 @@ cogl_gl_error_to_string (GLenum error_code);
cogl_gl_error_to_string (__err)); \
} } G_STMT_END
#define GE_RET(ret, x) G_STMT_START { \
#define GE_RET(ret, ctx, x) G_STMT_START { \
GLenum __err; \
ret = (x); \
while ((__err = glGetError ()) != GL_NO_ERROR) \
ret = (ctx)->x; \
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
{ \
g_warning ("%s: GL error (%d): %s\n", \
G_STRLOC, \
@ -90,8 +90,8 @@ cogl_gl_error_to_string (GLenum error_code);
#else /* !COGL_GL_DEBUG */
#define GE(x) (x)
#define GE_RET(ret, x) (ret = (x))
#define GE(ctx, x) ((ctx)->x)
#define GE_RET(ret, ctx, x) (ret = ((ctx)->x))
#endif /* COGL_GL_DEBUG */