gsk: Enable depth testing

Use the appropriate depth testing function for transparent items.
This commit is contained in:
Emmanuele Bassi 2016-07-08 16:40:42 +01:00
parent c052443633
commit b98fb07419

View File

@ -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);