cogl: Set the layer matrix on the right layer instead of a random one
authorNeil Roberts <neil@linux.intel.com>
Wed, 9 Feb 2011 15:24:43 +0000 (15:24 +0000)
committerNeil Roberts <neil@linux.intel.com>
Wed, 9 Feb 2011 16:14:13 +0000 (16:14 +0000)
When uploading the layer matrix to GL it wasn't first calling
glActiveTextureMatrix to set the right texture unit for the
layer. This would end up setting the texture matrix on whatever layer
happened to be previously active. This happened to work for
test-cogl-multitexture presumably because it was coincidentally
setting the layer matrix on the last used layer.

clutter/cogl/cogl/cogl-pipeline-vertend-fixed.c
clutter/cogl/cogl/cogl-pipeline-vertend-glsl.c

index c26b568..57d6191 100644 (file)
@@ -83,6 +83,8 @@ _cogl_pipeline_vertend_fixed_add_layer (CoglPipeline *pipeline,
       _cogl_matrix_stack_set (unit->matrix_stack,
                               &authority->big_state->matrix);
 
+      _cogl_set_active_texture_unit (unit_index);
+
       _cogl_matrix_stack_flush_to_gl (unit->matrix_stack, COGL_MATRIX_TEXTURE);
     }
 
index f32109e..fda8681 100644 (file)
@@ -271,6 +271,8 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
       _cogl_matrix_stack_set (unit->matrix_stack,
                               &authority->big_state->matrix);
 
+      _cogl_set_active_texture_unit (unit_index);
+
       _cogl_matrix_stack_flush_to_gl (unit->matrix_stack, COGL_MATRIX_TEXTURE);
     }