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/mesh/editmesh_knife.c
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/mesh/editmesh_knife.c')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 84da02b3b41..2ee8918c5da 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -58,6 +58,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_screen.h"
#include "ED_space_api.h"
@@ -1010,7 +1011,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_TRANSFORM);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, v1);
@@ -1041,7 +1042,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
View3D *v3d = CTX_wm_view3d(C);
const KnifeTool_OpData *kcd = arg;
- if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(false);
glPolygonOffset(1.0f, 1.0f);
@@ -1057,7 +1058,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
knifetool_draw_angle_snapping(kcd);
immUniformColor3ubv(kcd->colors.line);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->prev.cage);
@@ -1067,7 +1068,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->prev.vert) {
immUniformColor3ubv(kcd->colors.point);
- glPointSize(11);
+ GPU_point_size(11);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
@@ -1076,7 +1077,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->prev.bmface) {
immUniformColor3ubv(kcd->colors.curpoint);
- glPointSize(9);
+ GPU_point_size(9);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
@@ -1085,7 +1086,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->curr.edge) {
immUniformColor3ubv(kcd->colors.edge);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->curr.edge->v1->cageco);
@@ -1094,7 +1095,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
else if (kcd->curr.vert) {
immUniformColor3ubv(kcd->colors.point);
- glPointSize(11);
+ GPU_point_size(11);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
@@ -1103,7 +1104,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->curr.bmface) {
immUniformColor3ubv(kcd->colors.curpoint);
- glPointSize(9);
+ GPU_point_size(9);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
@@ -1114,12 +1115,12 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeLineHit *lh;
int i;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* draw any snapped verts first */
immUniformColor4ubv(kcd->colors.point_a);
- glPointSize(11);
+ GPU_point_size(11);
immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
@@ -1134,7 +1135,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
/* now draw the rest */
immUniformColor4ubv(kcd->colors.curpoint_a);
- glPointSize(7);
+ GPU_point_size(7);
immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
@@ -1147,7 +1148,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (kcd->totkedge > 0) {
@@ -1155,7 +1156,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeEdge *kfe;
immUniformColor3ubv(kcd->colors.line);
- glLineWidth(1.0);
+ GPU_line_width(1.0);
immBeginAtMost(GWN_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2);
@@ -1176,7 +1177,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeVert *kfv;
immUniformColor3ubv(kcd->colors.point);
- glPointSize(5.0);
+ GPU_point_size(5.0);
immBeginAtMost(GWN_PRIM_POINTS, BLI_mempool_len(kcd->kverts));
@@ -1195,7 +1196,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
gpuPopMatrix();
- if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(true);
}
/**