* clutter/cogl/gl/cogl.c (error_string):
* clutter/cogl/gles/cogl.c (error_string): Rename to _cogl_error_string and remove the static scoping so that it can be called in cogl-texture etc. * clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign): * clutter/cogl/gles/cogl-texture.c (cogl_texture_new_from_foreign): GE(*) can't be used to wrap around calls that use the return value. * clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw) (_cogl_texture_quad_hw, cogl_texture_polygon): Remove GE(*) wrapper around calls in the middle of a glBegin/glEnd pair which otherwise always generate an error because glGetError can only be called outside of the pair. * clutter/cogl/gl/cogl-internal.h: Include stdio.h when definig COGL_DEBUG and declare a prototype for _cogl_error_string. * clutter/cogl/gles/cogl-internal.h: Match GE(*) macro to GL version.
This commit is contained in:
parent
9f5a8edc64
commit
f9e43c440b
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
|||||||
|
2008-05-21 Neil Roberts <neil@o-hand.com>
|
||||||
|
|
||||||
|
* clutter/cogl/gl/cogl.c (error_string):
|
||||||
|
* clutter/cogl/gles/cogl.c (error_string): Rename to
|
||||||
|
_cogl_error_string and remove the static scoping so that it can be
|
||||||
|
called in cogl-texture etc.
|
||||||
|
|
||||||
|
* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign):
|
||||||
|
* clutter/cogl/gles/cogl-texture.c (cogl_texture_new_from_foreign):
|
||||||
|
GE(*) can't be used to wrap around calls that use the return
|
||||||
|
value.
|
||||||
|
|
||||||
|
* clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw)
|
||||||
|
(_cogl_texture_quad_hw, cogl_texture_polygon): Remove GE(*)
|
||||||
|
wrapper around calls in the middle of a glBegin/glEnd pair which
|
||||||
|
otherwise always generate an error because glGetError can only be
|
||||||
|
called outside of the pair.
|
||||||
|
|
||||||
|
* clutter/cogl/gl/cogl-internal.h: Include stdio.h when definig
|
||||||
|
COGL_DEBUG and declare a prototype for _cogl_error_string.
|
||||||
|
|
||||||
|
* clutter/cogl/gles/cogl-internal.h: Match GE(*) macro to GL
|
||||||
|
version.
|
||||||
|
|
||||||
2008-05-21 Ivan Leben <ivan@o-hand.com>
|
2008-05-21 Ivan Leben <ivan@o-hand.com>
|
||||||
|
|
||||||
* clutter/cogl/gles/cogl-texture.c:
|
* clutter/cogl/gles/cogl-texture.c:
|
||||||
|
@ -29,18 +29,26 @@
|
|||||||
#define COGL_DEBUG 0
|
#define COGL_DEBUG 0
|
||||||
|
|
||||||
#if COGL_DEBUG
|
#if COGL_DEBUG
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
const char *_cogl_error_string(GLenum errorCode);
|
||||||
|
|
||||||
#define GE(x...) G_STMT_START { \
|
#define GE(x...) G_STMT_START { \
|
||||||
GLenum err; \
|
GLenum err; \
|
||||||
(x); \
|
(x); \
|
||||||
while ((err = glGetError()) != GL_NO_ERROR) { \
|
while ((err = glGetError()) != GL_NO_ERROR) { \
|
||||||
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
||||||
(char *)error_string(err), \
|
(char *)_cogl_error_string(err), \
|
||||||
__FILE__, __LINE__); \
|
__FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
#else
|
|
||||||
|
#else /* COGL_DEBUG */
|
||||||
|
|
||||||
#define GE(x) (x);
|
#define GE(x) (x);
|
||||||
#endif
|
|
||||||
|
#endif /* COGL_DEBUG */
|
||||||
|
|
||||||
#define COGL_ENABLE_BLEND (1<<1)
|
#define COGL_ENABLE_BLEND (1<<1)
|
||||||
#define COGL_ENABLE_TEXTURE_2D (1<<2)
|
#define COGL_ENABLE_TEXTURE_2D (1<<2)
|
||||||
|
@ -1235,7 +1235,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
/* Make sure it is a valid GL texture object */
|
/* Make sure it is a valid GL texture object */
|
||||||
gl_istexture = GE( glIsTexture (gl_handle) );
|
gl_istexture = glIsTexture (gl_handle);
|
||||||
if (gl_istexture == GL_FALSE)
|
if (gl_istexture == GL_FALSE)
|
||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
@ -1863,21 +1863,21 @@ _cogl_texture_quad_sw (CoglTexture *tex,
|
|||||||
#define CFX_F CLUTTER_FIXED_TO_FLOAT
|
#define CFX_F CLUTTER_FIXED_TO_FLOAT
|
||||||
|
|
||||||
/* Draw textured quad */
|
/* Draw textured quad */
|
||||||
GE( glBegin (GL_QUADS) );
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(slice_tx1), CFX_F(slice_ty1)) );
|
glTexCoord2f (CFX_F(slice_tx1), CFX_F(slice_ty1));
|
||||||
GE( glVertex2f (CFX_F(slice_qx1), CFX_F(slice_qy1)) );
|
glVertex2f (CFX_F(slice_qx1), CFX_F(slice_qy1));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(slice_tx2), CFX_F(slice_ty1)) );
|
glTexCoord2f (CFX_F(slice_tx2), CFX_F(slice_ty1));
|
||||||
GE( glVertex2f (CFX_F(slice_qx2), CFX_F(slice_qy1)) );
|
glVertex2f (CFX_F(slice_qx2), CFX_F(slice_qy1));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(slice_tx2), CFX_F(slice_ty2)) );
|
glTexCoord2f (CFX_F(slice_tx2), CFX_F(slice_ty2));
|
||||||
GE( glVertex2f (CFX_F(slice_qx2), CFX_F(slice_qy2)) );
|
glVertex2f (CFX_F(slice_qx2), CFX_F(slice_qy2));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(slice_tx1), CFX_F(slice_ty2)) );
|
glTexCoord2f (CFX_F(slice_tx1), CFX_F(slice_ty2));
|
||||||
GE( glVertex2f (CFX_F(slice_qx1), CFX_F(slice_qy2)) );
|
glVertex2f (CFX_F(slice_qx1), CFX_F(slice_qy2));
|
||||||
|
|
||||||
glEnd ();
|
GE( glEnd () );
|
||||||
|
|
||||||
#undef CFX_F
|
#undef CFX_F
|
||||||
}
|
}
|
||||||
@ -1946,21 +1946,21 @@ _cogl_texture_quad_hw (CoglTexture *tex,
|
|||||||
#define CFX_F(x) CLUTTER_FIXED_TO_FLOAT(x)
|
#define CFX_F(x) CLUTTER_FIXED_TO_FLOAT(x)
|
||||||
|
|
||||||
/* Draw textured quad */
|
/* Draw textured quad */
|
||||||
GE( glBegin (GL_QUADS) );
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(tx1), CFX_F(ty1)) );
|
glTexCoord2f (CFX_F(tx1), CFX_F(ty1));
|
||||||
GE( glVertex2f (CFX_F(x1), CFX_F(y1)) );
|
glVertex2f (CFX_F(x1), CFX_F(y1));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(tx2), CFX_F(ty1)) );
|
glTexCoord2f (CFX_F(tx2), CFX_F(ty1));
|
||||||
GE( glVertex2f (CFX_F(x2), CFX_F(y1)) );
|
glVertex2f (CFX_F(x2), CFX_F(y1));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(tx2), CFX_F(ty2)) );
|
glTexCoord2f (CFX_F(tx2), CFX_F(ty2));
|
||||||
GE( glVertex2f (CFX_F(x2), CFX_F(y2)) );
|
glVertex2f (CFX_F(x2), CFX_F(y2));
|
||||||
|
|
||||||
GE( glTexCoord2f (CFX_F(tx1), CFX_F(ty2)) );
|
glTexCoord2f (CFX_F(tx1), CFX_F(ty2));
|
||||||
GE( glVertex2f (CFX_F(x1), CFX_F(y2)) );
|
glVertex2f (CFX_F(x1), CFX_F(y2));
|
||||||
|
|
||||||
glEnd ();
|
GE( glEnd () );
|
||||||
|
|
||||||
#undef CFX_F
|
#undef CFX_F
|
||||||
}
|
}
|
||||||
@ -2122,7 +2122,7 @@ cogl_texture_polygon (CoglHandle handle,
|
|||||||
|
|
||||||
GE( glBindTexture (tex->gl_target, gl_handle) );
|
GE( glBindTexture (tex->gl_target, gl_handle) );
|
||||||
|
|
||||||
GE( glBegin (GL_TRIANGLE_FAN) );
|
glBegin (GL_TRIANGLE_FAN);
|
||||||
|
|
||||||
for (vnum = 0; vnum < n_vertices; vnum++)
|
for (vnum = 0; vnum < n_vertices; vnum++)
|
||||||
{
|
{
|
||||||
@ -2146,11 +2146,11 @@ cogl_texture_polygon (CoglHandle handle,
|
|||||||
ty *= y_span->size;
|
ty *= y_span->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
GE( glTexCoord2f (tx, ty) );
|
glTexCoord2f (tx, ty);
|
||||||
|
|
||||||
GE( glVertex3f (CLUTTER_FIXED_TO_FLOAT (vertices[vnum].x),
|
glVertex3f (CLUTTER_FIXED_TO_FLOAT (vertices[vnum].x),
|
||||||
CLUTTER_FIXED_TO_FLOAT (vertices[vnum].y),
|
CLUTTER_FIXED_TO_FLOAT (vertices[vnum].y),
|
||||||
CLUTTER_FIXED_TO_FLOAT (vertices[vnum].z)) );
|
CLUTTER_FIXED_TO_FLOAT (vertices[vnum].z));
|
||||||
}
|
}
|
||||||
|
|
||||||
GE( glEnd () );
|
GE( glEnd () );
|
||||||
|
@ -66,8 +66,8 @@ static const struct token_string Errors[] = {
|
|||||||
{ ~0, NULL }
|
{ ~0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char*
|
const char*
|
||||||
error_string(GLenum errorCode)
|
_cogl_error_string(GLenum errorCode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; Errors[i].String; i++) {
|
for (i = 0; Errors[i].String; i++) {
|
||||||
|
@ -29,19 +29,26 @@
|
|||||||
#define COGL_DEBUG 0
|
#define COGL_DEBUG 0
|
||||||
|
|
||||||
#if COGL_DEBUG
|
#if COGL_DEBUG
|
||||||
#define GE(x...) { \
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
const char *_cogl_error_string(GLenum errorCode);
|
||||||
|
|
||||||
|
#define GE(x...) G_STMT_START { \
|
||||||
GLenum err; \
|
GLenum err; \
|
||||||
(x); \
|
(x); \
|
||||||
fprintf(stderr, "%s\n", #x); \
|
|
||||||
while ((err = glGetError()) != GL_NO_ERROR) { \
|
while ((err = glGetError()) != GL_NO_ERROR) { \
|
||||||
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
fprintf(stderr, "glError: %s caught at %s:%u\n", \
|
||||||
(char *)error_string(err), \
|
(char *)_cogl_error_string(err), \
|
||||||
__FILE__, __LINE__); \
|
__FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
}
|
} G_STMT_END
|
||||||
#else
|
|
||||||
|
#else /* COGL_DEBUG */
|
||||||
|
|
||||||
#define GE(x) (x);
|
#define GE(x) (x);
|
||||||
#endif
|
|
||||||
|
#endif /* COGL_DEBUG */
|
||||||
|
|
||||||
#define COGL_ENABLE_BLEND (1<<1)
|
#define COGL_ENABLE_BLEND (1<<1)
|
||||||
#define COGL_ENABLE_TEXTURE_2D (1<<2)
|
#define COGL_ENABLE_TEXTURE_2D (1<<2)
|
||||||
|
@ -1248,7 +1248,7 @@ cogl_texture_new_from_foreign (GLuint gl_handle,
|
|||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
/* Make sure it is a valid GL texture object */
|
/* Make sure it is a valid GL texture object */
|
||||||
gl_istexture = GE( glIsTexture (gl_handle) );
|
gl_istexture = glIsTexture (gl_handle);
|
||||||
if (gl_istexture == GL_FALSE)
|
if (gl_istexture == GL_FALSE)
|
||||||
return COGL_INVALID_HANDLE;
|
return COGL_INVALID_HANDLE;
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ static const struct token_string Errors[] = {
|
|||||||
{ ~0, NULL }
|
{ ~0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char*
|
const char*
|
||||||
error_string(GLenum errorCode)
|
_cogl_error_string(GLenum errorCode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; Errors[i].String; i++) {
|
for (i = 0; Errors[i].String; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user