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 --- source/blender/editors/space_text/space_text.c | 3 ++- source/blender/editors/space_text/text_draw.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_text') diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index e827f4f0149..f57a1c0eb89 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -59,6 +59,7 @@ #include "text_format.h" #include "text_intern.h" /* own include */ +#include "GPU_framebuffer.h" /* ******************** default callbacks for text space ***************** */ @@ -441,7 +442,7 @@ static void text_main_region_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + GPU_clear(GPU_COLOR_BIT); // UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index c1b49fbd32a..99305b143c6 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -50,6 +50,7 @@ #include "BIF_glutil.h" #include "GPU_immediate.h" +#include "GPU_state.h" #include "UI_interface.h" #include "UI_resources.h" @@ -1207,10 +1208,10 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar) immUniformColor4ub(255, 255, 255, 32); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); + GPU_blend(true); immRecti(pos, x1 - 4, y1, x2, y2); - glDisable(GL_BLEND); + GPU_blend(false); } } @@ -1506,7 +1507,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); float viewport_size[4]; - glGetFloatv(GL_VIEWPORT, viewport_size); + GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); immUniform1i("num_colors", 0); /* "simple" mode */ -- cgit v1.2.3