[fixed-to-float-patches] Fix use of glClearColor and glColor under GLES 2

The wrapper for glClearColor was taking fixed arguments but was given
floating point values so it ended up always setting the clear color to
black. Now that GLES 1.1 is using the floating point version, there is
no need for the wrapper so both versions now just use glClearColor
directly.

A similar problem was happening for glColor but this does still need a
wrapper because it needs to set the vertex attribute.
This commit is contained in:
Neil Roberts 2009-01-15 18:53:52 +00:00
parent 4e94500a2a
commit bef099ce40
3 changed files with 91 additions and 8 deletions

View File

@ -1,8 +1,40 @@
diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.c b/clutter/cogl/gles/cogl-gles2-wrapper.c
index b2e19eb..9435131 100644
index b2e19eb..a7800c5 100644
--- a/clutter/cogl/gles/cogl-gles2-wrapper.c
+++ b/clutter/cogl/gles/cogl-gles2-wrapper.c
@@ -1158,15 +1158,6 @@ cogl_wrap_glClipPlanex (GLenum plane, GLfloat *equation)
@@ -515,15 +515,6 @@ cogl_gles2_wrapper_update_matrix (CoglGles2Wrapper *wrapper, GLenum matrix_num)
}
void
-cogl_wrap_glClearColorx (GLclampx r, GLclampx g, GLclampx b, GLclampx a)
-{
- glClearColor ( (r),
- (g),
- (b),
- (a));
-}
-
-void
cogl_wrap_glPushMatrix ()
{
const float *src;
@@ -1143,13 +1134,9 @@ cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref)
}
void
-cogl_wrap_glColor4x (GLclampx r, GLclampx g, GLclampx b, GLclampx a)
+cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a)
{
- glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB,
- (r),
- (g),
- (b),
- (a));
+ glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB, r, g, b, a);
}
void
@@ -1158,15 +1145,6 @@ cogl_wrap_glClipPlanex (GLenum plane, GLfloat *equation)
/* FIXME */
}
@ -18,7 +50,7 @@ index b2e19eb..9435131 100644
void
cogl_wrap_glGetIntegerv (GLenum pname, GLint *params)
{
@@ -1185,31 +1176,24 @@ cogl_wrap_glGetIntegerv (GLenum pname, GLint *params)
@@ -1185,31 +1163,24 @@ cogl_wrap_glGetIntegerv (GLenum pname, GLint *params)
}
void

View File

@ -1,8 +1,23 @@
diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h
index 8cb9e8b..a194157 100644
index 8cb9e8b..561cb66 100644
--- a/clutter/cogl/gles/cogl-gles2-wrapper.h
+++ b/clutter/cogl/gles/cogl-gles2-wrapper.h
@@ -244,7 +244,7 @@ void cogl_wrap_glColor4x (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
@@ -203,8 +203,6 @@ struct _CoglGles2WrapperShader
void cogl_gles2_wrapper_init (CoglGles2Wrapper *wrapper);
void cogl_gles2_wrapper_deinit (CoglGles2Wrapper *wrapper);
-void cogl_wrap_glClearColorx (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
-
void cogl_wrap_glPushMatrix ();
void cogl_wrap_glPopMatrix ();
void cogl_wrap_glMatrixMode (GLenum mode);
@@ -239,12 +237,12 @@ void cogl_wrap_glDisableClientState (GLenum array);
void cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref);
-void cogl_wrap_glColor4x (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
+void cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a);
void cogl_wrap_glClipPlanex (GLenum plane, GLfloat *equation);
void cogl_wrap_glGetIntegerv (GLenum pname, GLint *params);
@ -11,8 +26,20 @@ index 8cb9e8b..a194157 100644
void cogl_wrap_glFogx (GLenum pname, GLfloat param);
void cogl_wrap_glFogxv (GLenum pname, const GLfloat *params);
@@ -299,7 +299,7 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
#define cogl_wrap_glColor4x glColor4f
@@ -273,7 +271,6 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
/* If we're not using GL ES 2 then just use the GL functions
directly */
-#define cogl_wrap_glClearColorx glClearColor
#define cogl_wrap_glDrawArrays glDrawArrays
#define cogl_wrap_glDrawElements glDrawElements
#define cogl_wrap_glPushMatrix glPushMatrix
@@ -296,10 +293,10 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
#define cogl_wrap_glEnableClientState glEnableClientState
#define cogl_wrap_glDisableClientState glDisableClientState
#define cogl_wrap_glAlphaFunc glAlphaFunc
-#define cogl_wrap_glColor4x glColor4f
+#define cogl_wrap_glColor4f glColor4f
#define cogl_wrap_glClipPlanex glClipPlanef
#define cogl_wrap_glGetIntegerv glGetIntegerv
-#define cogl_wrap_glGetFixedv glGetFixedv

View File

@ -1,5 +1,5 @@
diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c
index 422d8b6..aa4e4fc 100644
index 422d8b6..cb7aa8e 100644
--- a/clutter/cogl/gles/cogl.c
+++ b/clutter/cogl/gles/cogl.c
@@ -37,6 +37,7 @@
@ -10,6 +10,30 @@ index 422d8b6..aa4e4fc 100644
/* GL error to string conversion */
#if COGL_DEBUG
@@ -92,10 +93,10 @@ cogl_paint_init (const CoglColor *color)
fprintf(stderr, "\n ============== Paint Start ================ \n");
#endif
- cogl_wrap_glClearColorx (cogl_color_get_red (color),
- cogl_color_get_green (color),
- cogl_color_get_blue (color),
- 0);
+ glClearColor (cogl_color_get_red (color),
+ cogl_color_get_green (color),
+ cogl_color_get_blue (color),
+ 0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
cogl_wrap_glDisable (GL_LIGHTING);
@@ -315,7 +316,7 @@ cogl_set_source_color (const CoglColor *color)
#else
/* conversion can cause issues with picking on some gles implementations */
- GE( cogl_wrap_glColor4x (cogl_color_get_red (color),
+ GE( cogl_wrap_glColor4f (cogl_color_get_red (color),
cogl_color_get_green (color),
cogl_color_get_blue (color),
cogl_color_get_alpha (color)) );
@@ -365,9 +366,8 @@ set_clip_plane (GLint plane_num,
/* Calculate the angle between the axes and the line crossing the