Disable depth buffer writes while rendering smoke in the viewport.
[blender.git] / source / blender / editors / space_view3d / drawvolume.c
index e93d840edddbe2131105c4c29a3344926b3301ea..8dbc27887442a0dabae231f21aa5d044de35d7ff 100644 (file)
@@ -379,11 +379,13 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
 
        /* setup buffer and draw */
 
-       int gl_depth = 0, gl_blend = 0;
+       int gl_depth = 0, gl_blend = 0, gl_depth_write = 0;
        glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend);
        glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
+       glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&gl_depth_write);
 
        glEnable(GL_DEPTH_TEST);
+       glDepthMask(GL_FALSE);
        glEnable(GL_BLEND);
        glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 
@@ -422,6 +424,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
 
        GPU_shader_unbind();
 
+       glDepthMask(gl_depth_write);
+
        if (!gl_blend) {
                glDisable(GL_BLEND);
        }