diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-11-08 07:22:17 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-11-08 07:22:17 +0300 |
commit | de101fe9a874f616ac0eb27942e7956345dbab8e (patch) | |
tree | d4969e91da1a3e6001d10ceca59fd540dd4842c9 /source/blender/editors/space_view3d/drawobject.c | |
parent | 0b83680d85a7e39105c94888005030538440a0a6 (diff) |
OpenGL: mesh edit mode uses edge overlays
Legacy GL uses GL_LINES, modern GL uses the good stuff.
Edit mode still has a long way to go...
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8be3352ffc1..cba9bebb914 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4368,13 +4368,33 @@ static void draw_em_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, Batch_set_builtin_program(surface, GPU_SHADER_3D_DEPTH_ONLY); Batch_draw(surface); - Batch *edges = MBC_get_all_edges(cageDM); - Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); - glEnable(GL_LINE_SMOOTH); - glLineWidth(1.5f); - Batch_draw(edges); - glDisable(GL_LINE_SMOOTH); + if (GLEW_VERSION_3_2) { + Batch *overlay = MBC_get_overlay_edges(cageDM); + Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY); + Batch_Uniform2f(overlay, "viewportSize", ar->winx, ar->winy); + Batch_draw(overlay); + +#if 0 /* TODO: use this SIMPLE variant for pure triangle meshes */ + Batch_set_builtin_program(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE); + /* use these defaults: + * const float edgeColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; + * Batch_Uniform4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f); + * Batch_Uniform4fv(surface, "outlineColor", edgeColor); + * Batch_Uniform1f(surface, "outlineWidth", 1.0f); + */ + Batch_Uniform2f(surface, "viewportSize", ar->winx, ar->winy); + Batch_draw(surface); +#endif + } + else { + Batch *edges = MBC_get_all_edges(cageDM); + Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR); + Batch_Uniform4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); + glEnable(GL_LINE_SMOOTH); + glLineWidth(1.5f); + Batch_draw(edges); + glDisable(GL_LINE_SMOOTH); + } #if 0 /* looks good even without points */ Batch *verts = MBC_get_all_verts(cageDM); |