Use COGL to establish GL state for ClutterGLXTexturePixmap
Using glEnable() directly confuses COGL and can result in problems like subsequent pick operations not working correctly. Get the material for the ClutterTexture and call cogl_material_flush_gl_state() instead. http://bugzilla.openedhand.com/show_bug.cgi?id=1483
This commit is contained in:
parent
65c5188c7e
commit
f9d996a460
@ -126,26 +126,18 @@ G_DEFINE_TYPE (ClutterGLXTexturePixmap, \
|
|||||||
static gboolean
|
static gboolean
|
||||||
texture_bind (ClutterGLXTexturePixmap *tex)
|
texture_bind (ClutterGLXTexturePixmap *tex)
|
||||||
{
|
{
|
||||||
GLuint handle = 0;
|
CoglHandle cogl_material;
|
||||||
GLenum target = 0;
|
|
||||||
CoglHandle cogl_tex;
|
CoglHandle cogl_tex;
|
||||||
|
|
||||||
|
/* It might be better to track if we've succesfully set a texture yet
|
||||||
|
* explicitly, rather than doing it indirectly like this.
|
||||||
|
*/
|
||||||
cogl_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE(tex));
|
cogl_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE(tex));
|
||||||
|
if (cogl_tex == COGL_INVALID_HANDLE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (!cogl_texture_get_gl_texture (cogl_tex, &handle, &target))
|
cogl_material = clutter_texture_get_cogl_material (CLUTTER_TEXTURE(tex));
|
||||||
return FALSE;
|
cogl_material_flush_gl_state (cogl_material, NULL);
|
||||||
|
|
||||||
glEnable(target);
|
|
||||||
|
|
||||||
/* FIXME: fire off an error here? */
|
|
||||||
glBindTexture (target, handle);
|
|
||||||
|
|
||||||
if (clutter_texture_get_filter_quality (CLUTTER_TEXTURE (tex))
|
|
||||||
== CLUTTER_TEXTURE_QUALITY_HIGH && tex->priv->can_mipmap)
|
|
||||||
{
|
|
||||||
cogl_texture_set_filters (cogl_tex,
|
|
||||||
CGL_LINEAR_MIPMAP_LINEAR,
|
|
||||||
CGL_LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user