[gtk+/wip/ebassi/gsk-renderer: 46/135] gsk: Enable depth testing



commit 829676c93da8787afd7d2cd43024e15c3cd29f2c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Jul 8 16:40:42 2016 +0100

    gsk: Enable depth testing
    
    Use the appropriate depth testing function for transparent items.

 gsk/gskglrenderer.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index 8291107..6a787d1 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -845,6 +845,13 @@ gsk_gl_renderer_render (GskRenderer *renderer,
   gsk_gl_renderer_clear (self);
 
   glDisable (GL_BLEND);
+  if (self->has_depth_buffer)
+    {
+      glEnable (GL_DEPTH_TEST);
+      glDepthFunc (GL_LESS);
+    }
+  else
+    glDisable (GL_DEPTH_TEST);
 
   /* Opaque pass: front-to-back */
   GSK_NOTE (OPENGL, g_print ("Rendering %u opaque items\n", self->opaque_render_items->len));
@@ -855,6 +862,12 @@ gsk_gl_renderer_render (GskRenderer *renderer,
       render_item (self, item);
     }
 
+  if (self->has_depth_buffer)
+    {
+      glEnable (GL_DEPTH_TEST);
+      glDepthFunc (GL_LEQUAL);
+    }
+
   glEnable (GL_BLEND);
   glBlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
   glBlendEquation (GL_FUNC_ADD);


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