[Bf-blender-cvs] [85174329d9] blender2.8: blender 2.8: OpenGL immediate mode: editmesh_loopcut.c
Mike Erwin
noreply at git.blender.org
Tue Jan 31 09:07:51 CET 2017
Commit: 85174329d9f5701ed1499d7205dd153ec81d0e00
Author: Mike Erwin
Date: Tue Jan 31 02:57:24 2017 -0500
Branches: blender2.8
https://developer.blender.org/rB85174329d9f5701ed1499d7205dd153ec81d0e00
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
===================================================================
M source/blender/editors/mesh/editmesh_loopcut.c
===================================================================
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index f1c1e4105d..af8c8acef2 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);
}
More information about the Bf-blender-cvs
mailing list