From f2c19971e557f0d30fec2a25cb4d6ee835bc2bdb Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 29 Oct 2008 12:19:27 +0000 Subject: [PATCH] Bug 1206 - Picking disabled dithering * clutter/clutter-main.c (_clutter_do_pick): After picking is finished, restore the state of glEnable (GL_DITHER). Otherwise it will cause the scene to look different after the first pick on low depth displays. (Thanks to Michael Boccara for the patch) --- ChangeLog | 9 +++++++++ clutter/clutter-main.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64bceef8d..af8201b68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-29 Neil Roberts + + Bug 1206 - Picking disabled dithering + + * clutter/clutter-main.c (_clutter_do_pick): After picking is + finished, restore the state of glEnable (GL_DITHER). Otherwise it + will cause the scene to look different after the first pick on low + depth displays. (Thanks to Michael Boccara for the patch) + 2008-10-28 Thomas Wood * clutter/clutter-color.c (param_color_set_default): Set the no copy diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index ef0187ede..ebd528a6b 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -353,6 +353,7 @@ _clutter_do_pick (ClutterStage *stage, GLint viewport[4]; ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; guint32 id; + GLboolean dither_was_on; context = clutter_context_get_default (); @@ -364,6 +365,7 @@ _clutter_do_pick (ClutterStage *stage, cogl_paint_init (&white); /* Disable dithering (if any) when doing the painting in pick mode */ + dither_was_on = glIsEnabled (GL_DITHER); glDisable (GL_DITHER); /* Render the entire scence in pick mode - just single colored silhouette's @@ -381,8 +383,9 @@ _clutter_do_pick (ClutterStage *stage, */ glFinish(); - /* glEnable (GL_DITHER); we never enabled this originally, so its - probably not safe to then enable it */ + /* Restore whether GL_DITHER was enabled */ + if (dither_was_on) + glEnable (GL_DITHER); /* Read the color of the screen co-ords pixel */ glReadPixels (x, viewport[3] - y -1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);