Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2018-06-28 04:07:23 +0300
committerRay Molenkamp <github@lazydodo.com>2018-06-28 04:07:23 +0300
commit8e02106d0ddc7b31844d26037a824d56d3c65663 (patch)
treebfa1898220d74ac9610b8a1363a4087a44f7b41d /source/blender/editors/uvedit
parentfe258fd4451a7fb1ccdd85d1607b6dbd30442f28 (diff)
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
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c39
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c7
2 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index b3f3d188851..da50fe51d27 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -64,6 +64,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_image.h"
#include "ED_mesh.h"
@@ -87,7 +88,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
x_fac = zoom[0];
y_fac = zoom[1];
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
gpuTranslate2fv(cursor);
@@ -96,7 +97,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
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", 2); /* "advanced" mode */
@@ -654,8 +655,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* draw transparent faces */
UI_GetThemeColor4fv(TH_FACE, col1);
UI_GetThemeColor4fv(TH_FACE_SELECT, col2);
- 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);
Gwn_VertFormat *format = immVertexFormat();
pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -691,7 +692,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
if (efa_act && !uvedit_face_visible_test(scene, obedit, ima, efa_act)) {
@@ -706,9 +707,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* 4. draw edges */
if (sima->flag & SI_SMOOTH_UV) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_line_smooth(true);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -719,13 +720,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
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", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.56f, 0.56f, 0.56f, 1.0f}, {0.07f, 0.07f, 0.07f, 1.0f}}, 2);
immUniform1f("dash_width", 4.0f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
break;
}
@@ -738,13 +739,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
else {
immUniformColor3f(0.0f, 0.0f, 0.0f);
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
break;
case SI_UVDT_OUTLINE:
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(0x0);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
break;
}
@@ -780,7 +781,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
if (sima->dt_uv == SI_UVDT_OUTLINE) {
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
UI_GetThemeColor4fv(TH_WIRE_EDIT, col2);
if (me->drawflag & ME_DRAWEDGES) {
@@ -883,8 +884,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
GWN_batch_discard(loop_batch);
if (sima->flag & SI_SMOOTH_UV) {
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
/* 5. draw face centers */
@@ -900,7 +901,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totface);
@@ -961,7 +962,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* unselected uvs */
immUniformThemeColor(TH_VERTEX);
pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
@@ -980,7 +981,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* pinned uvs */
/* give odd pointsizes odd pin pointsizes */
- glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
+ GPU_point_size(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
imm_cpack(0xFF);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
@@ -1001,7 +1002,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* selected uvs */
immUniformThemeColor(TH_VERTEX_SELECT);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index bac30830516..9091f3eff0b 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -65,6 +65,7 @@
#include "ED_space_api.h"
#include "GPU_batch.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -1570,7 +1571,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* Static Tris */
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col);
@@ -1623,12 +1624,12 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col);
stitch_draw_vbo(vbo_line, GWN_PRIM_LINES, col);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* draw stitch vert/lines preview */
if (state->mode == STITCH_VERT) {
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f);
+ GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col);
vbo = GWN_vertbuf_create_with_format(&format);