diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-01-31 10:57:24 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-01-31 11:07:47 +0300 |
commit | 85174329d9f5701ed1499d7205dd153ec81d0e00 (patch) | |
tree | 727282a58f0a0a95b251619774d831fdef36fa5a /source/blender/editors/mesh | |
parent | b997914f8074a8a715ddcf80f16e5b0ddd5549c6 (diff) |
blender 2.8: OpenGL immediate mode: editmesh_loopcut.c
Reviewers: merwin
Reviewed By: merwin
Subscribers: dfelinto
Tags: #bf_blender_2.8
Maniphest Tasks: T49043
Differential Revision: https://developer.blender.org/D2480
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index f1c1e4105d0..af8c8acef28 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -47,6 +47,8 @@ #include "BIF_gl.h" +#include "GPU_immediate.h" + #include "UI_interface.h" #include "ED_screen.h" @@ -107,24 +109,38 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) glPushMatrix(); glMultMatrixf(lcd->ob->obmat); - glColor3ub(255, 0, 255); + unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + immUniformColor3ub(255, 0, 255); + if (lcd->totedge > 0) { - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, lcd->edges); - glDrawArrays(GL_LINES, 0, lcd->totedge * 2); - glDisableClientState(GL_VERTEX_ARRAY); + immBegin(GL_LINES, lcd->totedge * 2); + + for (int i = 0; i < lcd->totedge; i++) { + immVertex3fv(pos, lcd->edges[i][0]); + immVertex3fv(pos, lcd->edges[i][1]); + } + + immEnd(); } if (lcd->totpoint > 0) { glPointSize(3.0f); - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, lcd->points); - glDrawArrays(GL_POINTS, 0, lcd->totpoint); - glDisableClientState(GL_VERTEX_ARRAY); + immBegin(GL_POINTS, lcd->totpoint); + + for (int i = 0; i < lcd->totpoint; i++) { + immVertex3fv(pos, lcd->points[i]); + } + + immEnd(); } + immUnbindProgram(); + glPopMatrix(); + if (v3d && v3d->zbuf) glEnable(GL_DEPTH_TEST); } |