[cogl/wip/neil/snippets: 1/22] attribute: Guard the fixed function client state calls
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/neil/snippets: 1/22] attribute: Guard the fixed function client state calls
- Date: Thu, 1 Dec 2011 12:04:52 +0000 (UTC)
commit 4e9aaf5c33b8a6893d6dbb47919bd9cdd24b2751
Author: Neil Roberts <neil linux intel com>
Date: Tue Nov 29 20:39:01 2011 +0000
attribute: Guard the fixed function client state calls
This adds #ifdefs around the fixed function client state enabling
calls so that it will still build when only gles2 is enabled.
cogl/cogl-attribute.c | 66 +++++++++++++++++++++++++++++++-----------------
1 files changed, 42 insertions(+), 24 deletions(-)
---
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index 755cea7..547736f 100644
--- a/cogl/cogl-attribute.c
+++ b/cogl/cogl-attribute.c
@@ -381,26 +381,35 @@ static gboolean
toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
{
ForeachChangedBitState *state = user_data;
- gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
CoglContext *context = state->context;
- GLenum cap;
- switch (bit_num)
- {
- case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
- cap = GL_COLOR_ARRAY;
- break;
- case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
- cap = GL_VERTEX_ARRAY;
- break;
- case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
- cap = GL_NORMAL_ARRAY;
- break;
- }
- if (enabled)
- GE (context, glEnableClientState (cap));
- else
- GE (context, glDisableClientState (cap));
+ _COGL_RETURN_VAL_IF_FAIL (context->driver == COGL_DRIVER_GL ||
+ context->driver == COGL_DRIVER_GLES1,
+ FALSE);
+
+#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
+ {
+ gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
+ GLenum cap;
+
+ switch (bit_num)
+ {
+ case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
+ cap = GL_COLOR_ARRAY;
+ break;
+ case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
+ cap = GL_VERTEX_ARRAY;
+ break;
+ case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
+ cap = GL_NORMAL_ARRAY;
+ break;
+ }
+ if (enabled)
+ GE (context, glEnableClientState (cap));
+ else
+ GE (context, glDisableClientState (cap));
+ }
+#endif
return TRUE;
}
@@ -409,15 +418,24 @@ static gboolean
toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
{
ForeachChangedBitState *state = user_data;
- gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
CoglContext *context = state->context;
- GE( context, glClientActiveTexture (GL_TEXTURE0 + bit_num) );
+ _COGL_RETURN_VAL_IF_FAIL (context->driver == COGL_DRIVER_GL ||
+ context->driver == COGL_DRIVER_GLES1,
+ FALSE);
- if (enabled)
- GE( context, glEnableClientState (GL_TEXTURE_COORD_ARRAY) );
- else
- GE( context, glDisableClientState (GL_TEXTURE_COORD_ARRAY) );
+#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
+ {
+ gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
+
+ GE( context, glClientActiveTexture (GL_TEXTURE0 + bit_num) );
+
+ if (enabled)
+ GE( context, glEnableClientState (GL_TEXTURE_COORD_ARRAY) );
+ else
+ GE( context, glDisableClientState (GL_TEXTURE_COORD_ARRAY) );
+ }
+#endif
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]