[Bf-blender-cvs] [cdcdddd] blender2.8: OpenGL: disable GL_CULL_FACE state only when needed

Mike Erwin noreply at git.blender.org
Fri Oct 21 22:27:46 CEST 2016


Commit: cdcddddd96441dc26baeddb173b45f862539d141
Author: Mike Erwin
Date:   Fri Oct 21 16:25:17 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBcdcddddd96441dc26baeddb173b45f862539d141

OpenGL: disable GL_CULL_FACE state only when needed

The active camera has a solid "up" triangle instead of the usual outline. We want to see both sides of this triangle. Disable face culling only when drawing the active camera, not for every camera.

===================================================================

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 2cdc407..c32ca31 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2184,7 +2184,6 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 	if (ob_wire_col) {
 		immUniformColor3ubv(ob_wire_col);
 	}
-	glDisable(GL_CULL_FACE);
 	glLineWidth(1);
 
 	/* camera frame */
@@ -2227,7 +2226,10 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 	 * for active cameras so the wire can be seen side-on */
 	for (int i = 0; i < 2; i++) {
 		if (i == 0) immBegin(GL_LINE_LOOP, 3);
-		else if (i == 1 && is_active) immBegin(GL_TRIANGLES, 3);
+		else if (i == 1 && is_active) {
+			glDisable(GL_CULL_FACE); /* TODO: declarative state tracking */
+			immBegin(GL_TRIANGLES, 3);
+		}
 		else break;
 
 		tvec[0] = shift[0] + ((-0.7f * drawsize) * scale[0]);




More information about the Bf-blender-cvs mailing list