diff --git a/ChangeLog b/ChangeLog index ac561157a..32c77e71e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-13 Neil Roberts + + * clutter/cogl/gles/cogl-gles2-wrapper.h: + * clutter/cogl/gles/cogl-gles2-wrapper.c: + Initialise the 'tex' sampler uniform to 0. The GLSL spec + specifically says that you must initialize sampler uniforms. This + fixes texturing for GLES 2 when using the PowerVR simulator via + software Mesa. + 2008-11-13 Robert Bragg Gets the mesh API working with GLES2 diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.c b/clutter/cogl/gles/cogl-gles2-wrapper.c index a1629d559..25e3896a2 100644 --- a/clutter/cogl/gles/cogl-gles2-wrapper.c +++ b/clutter/cogl/gles/cogl-gles2-wrapper.c @@ -453,6 +453,9 @@ cogl_gles2_wrapper_get_uniforms (GLuint program, uniforms->alpha_test_ref_uniform = glGetUniformLocation (program, "alpha_test_ref"); + + uniforms->texture_unit_uniform + = glGetUniformLocation (program, "texture_unit"); } void @@ -885,6 +888,10 @@ cogl_wrap_glDrawArrays (GLenum mode, GLint first, GLsizei count) glUniform1f (program->uniforms.alpha_test_ref_uniform, w->alpha_test_ref); + if ((w->dirty_uniforms & COGL_GLES2_DIRTY_TEXTURE_UNIT) + && program->uniforms.texture_unit_uniform != -1) + glUniform1i (program->uniforms.texture_unit_uniform, 0); + w->dirty_uniforms = 0; } diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h index 119168625..19b062088 100644 --- a/clutter/cogl/gles/cogl-gles2-wrapper.h +++ b/clutter/cogl/gles/cogl-gles2-wrapper.h @@ -54,8 +54,9 @@ enum COGL_GLES2_DIRTY_FOG_END = 1 << 5, COGL_GLES2_DIRTY_FOG_COLOR = 1 << 6, COGL_GLES2_DIRTY_ALPHA_TEST_REF = 1 << 7, + COGL_GLES2_DIRTY_TEXTURE_UNIT = 1 << 8, - COGL_GLES2_DIRTY_ALL = (1 << 8) - 1 + COGL_GLES2_DIRTY_ALL = (1 << 9) - 1 }; struct _CoglGles2WrapperUniforms @@ -71,6 +72,8 @@ struct _CoglGles2WrapperUniforms GLint fog_color_uniform; GLint alpha_test_ref_uniform; + + GLint texture_unit_uniform; }; struct _CoglGles2WrapperSettings