diff options
author | Luca Rood <dev@lucarood.com> | 2017-01-26 17:39:36 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-01 22:32:33 +0300 |
commit | fd089843b3adf7e34b3a27b43b548fb6f8611616 (patch) | |
tree | 7fa7f3ab8f1ab0bca47c881c8ae0953f0a5b3bc1 /source/blender/editors/transform/transform_constraints.c | |
parent | eca2f918a7934c09bde7f499e3a521f60250ce4c (diff) |
OpenGL immediate mode: transform_constraints.c
Differential Revision: https://developer.blender.org/D2483
Part of T49043
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index d7b670b6476..a8183d11501 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -40,9 +40,10 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" -#include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_immediate.h" + #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_string.h" @@ -715,7 +716,6 @@ void drawConstraint(TransInfo *t) else { if (tc->mode & CON_SELECT) { float vec[3]; - char col2[3] = {255, 255, 255}; int depth_test_enabled; convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1])); @@ -725,19 +725,26 @@ void drawConstraint(TransInfo *t) drawLine(t, t->center_global, tc->mtx[1], 'Y', 0); drawLine(t, t->center_global, tc->mtx[2], 'Z', 0); - glColor3ubv((GLubyte *)col2); - depth_test_enabled = glIsEnabled(GL_DEPTH_TEST); if (depth_test_enabled) glDisable(GL_DEPTH_TEST); + unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + immUniformColor3ub(255, 255, 255); + setlinestyle(1); - glBegin(GL_LINES); - glVertex3fv(t->center_global); - glVertex3fv(vec); - glEnd(); + + immBegin(GL_LINES, 2); + immVertex3fv(pos, t->center_global); + immVertex3fv(pos, vec); + immEnd(); + setlinestyle(0); + immUnbindProgram(); + if (depth_test_enabled) glEnable(GL_DEPTH_TEST); } |