From 8e02106d0ddc7b31844d26037a824d56d3c65663 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Wed, 27 Jun 2018 19:07:23 -0600 Subject: GLRefactor: partially remove gl calls from source/blender/editors. This translates the gl calls to the new GPU_ wrappers from D3501. Given it's tedious and repetitive work, this patch does as much as it can with search + replace, the remainder of the gl calls will need to be manually dealt with on a case by case basis. This fixes 13 of the 28 failing editors when building without opengl. For the list of substitutions see D3502 Reviewers: brecht Differential Revision: https://developer.blender.org/D3502 --- .../manipulator_types/cage3d_manipulator.c | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c') diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c index 6c2e2bd564d..a907816b08f 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c @@ -48,6 +48,7 @@ #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_select.h" +#include "GPU_state.h" #include "RNA_access.h" #include "RNA_define.h" @@ -303,14 +304,14 @@ static void manipulator_cage3d_draw_intern( /* Handy for quick testing draw (if it's outside bounds). */ if (false) { - glEnable(GL_BLEND); + GPU_blend(true); uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); float s = 0.5f; immRectf(pos, -s, -s, s, s); immUnbindProgram(); - glDisable(GL_BLEND); + GPU_blend(false); } if (select) { @@ -358,13 +359,13 @@ static void manipulator_cage3d_draw_intern( #endif if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) { /* corner manipulators */ - glLineWidth(mpr->line_width + 3.0f); + GPU_line_width(mpr->line_width + 3.0f); cage3d_draw_box_corners(size_real, margin, (const float[3]){0, 0, 0}); /* corner manipulators */ float color[4]; manipulator_color_get(mpr, highlight, color); - glLineWidth(mpr->line_width); + GPU_line_width(mpr->line_width); cage3d_draw_box_corners(size_real, margin, color); bool show = false; @@ -388,29 +389,29 @@ static void manipulator_cage3d_draw_intern( float color[4]; manipulator_color_get(mpr, highlight, color); - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POLYGON_SMOOTH); - glEnable(GL_BLEND); + GPU_line_smooth(true); + GPU_polygon_smooth(true); + GPU_blend(true); - glLineWidth(mpr->line_width + 3.0f); + GPU_line_width(mpr->line_width + 3.0f); cage3d_draw_circle_wire(size_real, margin, (const float[3]){0, 0, 0}, transform_flag, draw_options); - glLineWidth(mpr->line_width); + GPU_line_width(mpr->line_width); cage3d_draw_circle_wire(size_real, margin, color, transform_flag, draw_options); /* corner manipulators */ cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, (const float[3]){0, 0, 0}, true, 60); cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 40); - glDisable(GL_BLEND); - glDisable(GL_POLYGON_SMOOTH); - glDisable(GL_LINE_SMOOTH); + GPU_blend(false); + GPU_polygon_smooth(false); + GPU_line_smooth(false); } else { BLI_assert(0); } } - glLineWidth(1.0); + GPU_line_width(1.0); gpuPopMatrix(); } -- cgit v1.2.3