pick: Use Cogl API not GL API to disable dithering

When picking we need to disable dithering to be sure that the hardware
will not modify the colors we use as actor identifiers. Clutter was
manually calling glEnable/Disable GL_DITHER to handle this, but that was
a layering violation since Cogl is intended to handle all interactions
with OpenGL. Since we are now striving for GL vs GLES to be a runtime
choice we need to remove this last direct usage of GL from Clutter so it
doesn't have to be linked with GL at build time.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-07-12 17:04:15 +01:00
parent 3183240fef
commit c6a0427c69

View File

@ -1261,7 +1261,8 @@ _clutter_stage_do_pick (ClutterStage *stage,
guchar pixel[4] = { 0xff, 0xff, 0xff, 0xff };
CoglColor stage_pick_id;
guint32 id_;
GLboolean dither_was_on;
gboolean dither_enabled_save;
CoglFramebuffer *fb;
ClutterActor *actor;
gboolean is_clipped;
CLUTTER_STATIC_COUNTER (do_pick_counter,
@ -1369,9 +1370,9 @@ _clutter_stage_do_pick (ClutterStage *stage,
CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_clear);
/* Disable dithering (if any) when doing the painting in pick mode */
dither_was_on = glIsEnabled (GL_DITHER);
if (dither_was_on)
glDisable (GL_DITHER);
fb = cogl_get_draw_framebuffer ();
dither_enabled_save = cogl_framebuffer_get_dither_enabled (fb);
cogl_framebuffer_set_dither_enabled (fb, FALSE);
/* Render the entire scence in pick mode - just single colored silhouette's
* are drawn offscreen (as we never swap buffers)
@ -1422,8 +1423,7 @@ _clutter_stage_do_pick (ClutterStage *stage,
}
/* Restore whether GL_DITHER was enabled */
if (dither_was_on)
glEnable (GL_DITHER);
cogl_framebuffer_set_dither_enabled (fb, dither_enabled_save);
if (pixel[0] == 0xff && pixel[1] == 0xff && pixel[2] == 0xff)
{