From b3a0bdf7f676a776faa04715ecb92d96aa947f84 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 9 Feb 2011 15:24:43 +0000 Subject: [PATCH] cogl: Set the layer matrix on the right layer instead of a random one 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. --- cogl/cogl-pipeline-vertend-fixed.c | 2 ++ cogl/cogl-pipeline-vertend-glsl.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cogl/cogl-pipeline-vertend-fixed.c b/cogl/cogl-pipeline-vertend-fixed.c index c26b56830..57d619126 100644 --- a/cogl/cogl-pipeline-vertend-fixed.c +++ b/cogl/cogl-pipeline-vertend-fixed.c @@ -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); } diff --git a/cogl/cogl-pipeline-vertend-glsl.c b/cogl/cogl-pipeline-vertend-glsl.c index f32109e1d..fda8681b3 100644 --- a/cogl/cogl-pipeline-vertend-glsl.c +++ b/cogl/cogl-pipeline-vertend-glsl.c @@ -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); }