diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-04-05 14:01:32 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-04-05 16:02:31 +0300 |
commit | 929c45b7d40536ce5fe572d19ebcbb70e9416a42 (patch) | |
tree | bbf7c6cbe1989375ac125c3bf85388486f033336 /source/blender/editors/sculpt_paint | |
parent | cbd78c81268f06e7b658ae042f3ab6a3816149b0 (diff) |
Paint cursor changes, so it save/load only the required flags
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index de629faac32..9bc163c6a62 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -57,6 +57,7 @@ #include "ED_view3d.h" +#include "GPU_draw.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" @@ -697,9 +698,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush, immUnbindProgram(); glPopMatrix(); /* TEXTURE */ + glMatrixMode(GL_MODELVIEW); if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) { - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); } } @@ -796,19 +797,8 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, /* color means that primary brush texture is colured and secondary is used for alpha/mask control */ bool col = ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex) ? true : false; OverlayControlFlags flags = BKE_paint_get_overlay_flags(); - /* save lots of GL state - * TODO: check on whether all of these are needed? */ - glPushAttrib(GL_COLOR_BUFFER_BIT | - GL_CURRENT_BIT | - GL_DEPTH_BUFFER_BIT | - GL_ENABLE_BIT | - GL_LINE_BIT | - GL_POLYGON_BIT | - GL_STENCIL_BUFFER_BIT | - GL_TRANSFORM_BIT | - GL_VIEWPORT_BIT | - GL_TEXTURE_BIT); - + GPUStateValues attribs; + gpuSaveState(&attribs, GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT); /* coloured overlay should be drawn separately */ if (col) { @@ -826,7 +816,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom); } - glPopAttrib(); + gpuRestoreState(&attribs); GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); } |