[Bf-blender-cvs] [de101fe] blender2.8: OpenGL: mesh edit mode uses edge overlays
Mike Erwin
noreply at git.blender.org
Tue Nov 8 05:41:18 CET 2016
Commit: de101fe9a874f616ac0eb27942e7956345dbab8e
Author: Mike Erwin
Date: Tue Nov 8 05:22:17 2016 +0100
Branches: blender2.8
https://developer.blender.org/rBde101fe9a874f616ac0eb27942e7956345dbab8e
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...
===================================================================
M source/blender/editors/space_view3d/drawobject.c
===================================================================
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8be3352..cba9beb 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);
More information about the Bf-blender-cvs
mailing list