From 8836c868a433bfae7296e1cb0a9ffb75c952d391 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 8 Jun 2010 17:26:26 +0100 Subject: [PATCH] cogl-gles2-wrapper: Fix some cases using the wrong texture unit At two places in cogl_wrap_prepare_for_draw it was trying to loop over the texture units to flush some state. However it was retrieving the texture unit pointer using w->active_texture_unit instead of the loop index so it would end up with the wrong state. Also in glEnableClientState it was using the active unit instead of the client active unit. --- cogl/driver/gles/cogl-gles2-wrapper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cogl/driver/gles/cogl-gles2-wrapper.c b/cogl/driver/gles/cogl-gles2-wrapper.c index 9aac851d9..11a223331 100644 --- a/cogl/driver/gles/cogl-gles2-wrapper.c +++ b/cogl/driver/gles/cogl-gles2-wrapper.c @@ -1276,7 +1276,7 @@ cogl_wrap_prepare_for_draw (void) GLint tex_coord_var_index; CoglGles2WrapperTextureUnit *texture_unit; - texture_unit = w->texture_units + w->active_texture_unit; + texture_unit = w->texture_units + i; if (!texture_unit->texture_coords_enabled) continue; @@ -1303,8 +1303,7 @@ cogl_wrap_prepare_for_draw (void) for (i = 0; i < COGL_GLES2_MAX_TEXTURE_UNITS; i++) { - CoglGles2WrapperTextureUnit *texture_unit - = w->texture_units + w->active_texture_unit; + CoglGles2WrapperTextureUnit *texture_unit = w->texture_units + i; GLint attrib = program->attributes.multi_texture_coords[i]; if (attrib != -1) @@ -1495,7 +1494,7 @@ cogl_wrap_glEnableClientState (GLenum array) case GL_TEXTURE_COORD_ARRAY: /* TODO - review if this should be in w->settings? */ - texture_unit = w->texture_units + w->active_texture_unit; + texture_unit = w->texture_units + w->active_client_texture_unit; if (texture_unit->texture_coords_enabled != 1) { texture_unit->texture_coords_enabled = 1;