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
This commit is contained in:
Damien Lespiau 2009-11-15 19:54:17 +00:00
parent 18b96c84bf
commit 3069ad6409

View File

@ -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 =