diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-17 13:15:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-17 13:24:31 +0300 |
commit | 9be5a94cf3e1d60f8c73e86c570f545e88eed49a (patch) | |
tree | e4f347c4b29b5abcd30eb3382ef11ecd6777324b /source/blender/editors/sculpt_paint/paint_cursor.c | |
parent | 398de6a86f47eff66f3a4369033f5df3347f6d94 (diff) |
Fix part of T69728: drawing glitches with sculpt dynamic mesh preview
Depth test must default to off for drawing outside the 3D viewport and
overlays like cursors.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 5c83bdf0012..c8c857d721b 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1191,7 +1191,13 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, static void sculpt_geometry_preview_lines_draw(const uint gpuattr, SculptSession *ss) { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.6f); - GPU_depth_test(true); + + /* Cursor normally draws on top, but for this part we need depth tests. */ + const bool depth_test = GPU_depth_test_enabled(); + if (!depth_test) { + GPU_depth_test(true); + } + GPU_line_width(1.0f); if (ss->preview_vert_index_count > 0) { immBegin(GPU_PRIM_LINES, ss->preview_vert_index_count); @@ -1200,6 +1206,11 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr, SculptSession } immEnd(); } + + /* Restore depth test value. */ + if (!depth_test) { + GPU_depth_test(false); + } } static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) |