From 3069ad640926e8f70e3a406acce518282b58b345 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Sun, 15 Nov 2009 19:54:17 +0000 Subject: [PATCH] cogl: Create CoglTextureUnit with its associated unit number The index field of CoglTextureUnit was never set, leading to the creation of units with index set to 0. When trying to retrieve a texture unit by its index (!= 0) with _cogl_get_texture_unit(), a new one was created as it could not find it back in the list of textures units: ctx->texture_units. http://bugzilla.openedhand.com/show_bug.cgi?id=1958 --- cogl/cogl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cogl/cogl.c b/cogl/cogl.c index aa61fd590..ca76641f5 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -729,10 +729,11 @@ cogl_end_gl (void) } static CoglTextureUnit * -_cogl_texture_unit_new (void) +_cogl_texture_unit_new (int index_) { CoglTextureUnit *unit = g_new0 (CoglTextureUnit, 1); unit->matrix_stack = _cogl_matrix_stack_new (); + unit->index = index_; return unit; } @@ -766,7 +767,7 @@ _cogl_get_texture_unit (int index_) /* NB: if we now insert a new layer before l, that will maintain order. */ - unit = _cogl_texture_unit_new (); + unit = _cogl_texture_unit_new (index_); /* Note: see comment after for() loop above */ ctx->texture_units =