[clutter] pick: Use Cogl API not GL API to disable dithering



commit c6a0427c69294e765728bdac4dc11b73fda55b12
Author: Robert Bragg <robert linux intel com>
Date:   Tue Jul 12 17:04:15 2011 +0100

    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>

 clutter/clutter-stage.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 991becf..7e9beb3 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -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)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]