[Bf-blender-cvs] [671a508] wiggly-widgets: Enable depth testing for widgets.
Antony Riakiotakis
noreply at git.blender.org
Wed Oct 8 12:46:06 CEST 2014
Commit: 671a508ae3ffa886abed6c465b9d231b59c5a1ea
Author: Antony Riakiotakis
Date: Wed Oct 8 12:45:54 2014 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB671a508ae3ffa886abed6c465b9d231b59c5a1ea
Enable depth testing for widgets.
Especially if we have many widgets on screen, sorting them will be
difficult and for mesh-armature widgets it will be unavoidable if we
want to avoid tweaking "back" surfaces.
===================================================================
M source/blender/editors/interface/interface_generic_widgets.c
M source/blender/editors/space_view3d/view3d_draw.c
===================================================================
diff --git a/source/blender/editors/interface/interface_generic_widgets.c b/source/blender/editors/interface/interface_generic_widgets.c
index 5a87c7a..9894ca0 100644
--- a/source/blender/editors/interface/interface_generic_widgets.c
+++ b/source/blender/editors/interface/interface_generic_widgets.c
@@ -488,15 +488,18 @@ static void widget_draw_intern(bool select, bool highlight)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short) * (NUM_INDICES), indices, GL_STATIC_DRAW);
- glEnable(GL_CULL_FACE);
if (highlight)
glColor3f(1.0, 1.0, 0.0);
else
glColor3f(0.0, 1.0, 0.0);
+
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
glDrawElements(GL_TRIANGLE_FAN, (ARROW_RESOLUTION + 2), GL_UNSIGNED_SHORT, NULL);
glDrawElements(GL_TRIANGLE_FAN, (ARROW_RESOLUTION + 2), GL_UNSIGNED_SHORT, (GLubyte *)NULL + sizeof(unsigned short) * (ARROW_RESOLUTION + 2));
glDrawElements(GL_TRIANGLE_STRIP, (2 * ARROW_RESOLUTION + 2), GL_UNSIGNED_SHORT, (GLubyte *)NULL + sizeof(unsigned short) * (2 * ARROW_RESOLUTION + 4));
glDrawElements(GL_TRIANGLE_FAN, (ARROW_RESOLUTION + 2), GL_UNSIGNED_SHORT, (GLubyte *)NULL + sizeof(unsigned short) * (4 * ARROW_RESOLUTION + 6));
+ glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glBindBuffer(GL_ARRAY_BUFFER, 0);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 36fec93..4003cb8 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3551,6 +3551,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
view3d_main_area_draw_engine(C, scene, ar, v3d, clip_border, &border_rect);
view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
+ glClear(GL_DEPTH_BUFFER_BIT);
WM_widgets_draw(C, ar);
ED_region_pixelspace(ar);
More information about the Bf-blender-cvs
mailing list