[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47105] branches/soc-2012-swiss_cheese/ source: OpenGL Policy - Assume vertex arrays are disabled, enabled the ones needed, disable all when done.

Jason Wilkins Jason.A.Wilkins at gmail.com
Mon May 28 09:47:08 CEST 2012


Revision: 47105
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47105
Author:   jwilkins
Date:     2012-05-28 07:47:08 +0000 (Mon, 28 May 2012)
Log Message:
-----------
OpenGL Policy - Assume vertex arrays are disabled, enabled the ones needed, disable all when done.

BGE was assuming that it was the only module using vertex arrays.

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/space_graph.c
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c	2012-05-28 05:48:02 UTC (rev 47104)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/animation/anim_markers.c	2012-05-28 07:47:08 UTC (rev 47105)
@@ -376,6 +376,7 @@
 		else
 			glColor4ub(0, 0, 0, 96);
 		
+		// DOODLE single 2D line, stippled
 		glBegin(GL_LINES);
 		glVertex2f((xpos * xscale) + 0.5f, 12.0f);
 		glVertex2f((xpos * xscale) + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
@@ -429,7 +430,7 @@
 		}
 #endif
 
-		UI_DrawString(x, y, marker->name);
+		UI_DrawString(x, y, marker->name); // DOODLE text label
 	}
 	
 	glScalef(xscale, 1.0f, 1.0f);

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c	2012-05-28 05:48:02 UTC (rev 47104)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c	2012-05-28 07:47:08 UTC (rev 47105)
@@ -53,6 +53,9 @@
 
 #include "BIF_gl.h"
 
+#define GPU_MANGLE_DEPRECATED 0
+#include "GPU_compatibility.h"
+
 #include "UI_interface.h"
 #include "UI_interface_icons.h"
 
@@ -901,7 +904,7 @@
 	
 	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	glColor3ubv(cp);
-
+	gpuColor3ubv(cp);
 }
 
 // plus alpha
@@ -911,7 +914,7 @@
 	
 	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	glColor4ubv(cp);
-
+	gpuColor4ubv(cp);
 }
 
 // set the color with offset for shades
@@ -929,6 +932,7 @@
 	CLAMP(b, 0, 255);
 	//glColor3ub(r, g, b);
 	glColor4ub(r, g, b, cp[3]);
+	gpuColor4ub(r, g, b, cp[3]);
 }
 void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
 {
@@ -945,6 +949,7 @@
 	a = alphaoffset + (int) cp[3];
 	CLAMP(a, 0, 255);
 	glColor4ub(r, g, b, a);
+	gpuColor4ub(r, g, b, a);
 }
 
 // blend between to theme colors, and set it
@@ -962,6 +967,7 @@
 	b = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
 	
 	glColor3ub(r, g, b);
+	gpuColor3ub(r, g, b);
 }
 
 // blend between to theme colors, shade it, and set it
@@ -983,6 +989,7 @@
 	CLAMP(b, 0, 255);
 	
 	glColor3ub(r, g, b);
+	gpuColor3ub(r, g, b);
 }
 
 // blend between to theme colors, shade it, and set it
@@ -1006,6 +1013,7 @@
 	CLAMP(a, 0, 255);
 
 	glColor4ub(r, g, b, a);
+	gpuColor4ub(r, g, b, a);
 }
 
 

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/space_graph.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/space_graph.c	2012-05-28 05:48:02 UTC (rev 47104)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/space_graph.c	2012-05-28 07:47:08 UTC (rev 47105)
@@ -269,6 +269,7 @@
 		UI_ThemeColorShadeAlpha(TH_CFRAME, -10, -50);
 		glLineWidth(2.0);
 		
+		// DOODLE single 2D line
 		glEnable(GL_BLEND);
 		glBegin(GL_LINE_STRIP);
 		vec[0] = v2d->cur.xmin;
@@ -287,7 +288,7 @@
 	
 	/* markers */
 	UI_view2d_view_orthoSpecial(ar, v2d, 1);
-	draw_markers_time(C, 0);
+	draw_markers_time(C, 0); // DOODLE multiple lines with labels
 	
 	/* preview range */
 	UI_view2d_view_ortho(v2d);

Modified: branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
===================================================================
--- branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp	2012-05-28 05:48:02 UTC (rev 47104)
+++ branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp	2012-05-28 07:47:08 UTC (rev 47105)
@@ -59,11 +59,6 @@
 	
 	if (result)
 	{
-		glEnableClientState(GL_VERTEX_ARRAY);
-		glEnableClientState(GL_NORMAL_ARRAY);
-		glDisableClientState(GL_COLOR_ARRAY);
-		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	}
 
@@ -95,11 +90,6 @@
 
 void RAS_VAOpenGLRasterizer::Exit()
 {
-	glDisableClientState(GL_VERTEX_ARRAY);
-	glDisableClientState(GL_NORMAL_ARRAY);
-	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-	glDisableClientState(GL_COLOR_ARRAY);
-
 	RAS_OpenGLRasterizer::Exit();
 }
 
@@ -116,6 +106,9 @@
 		return;
 	}
 
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_NORMAL_ARRAY);
+
 	if (!wireframe)
 		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
@@ -160,6 +153,9 @@
 		glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
 	}
 
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_NORMAL_ARRAY);
+
 	if (!wireframe) {
 		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 		glDisableClientState(GL_COLOR_ARRAY);
@@ -179,6 +175,9 @@
 		return;
 	}
 
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_NORMAL_ARRAY);
+
 	if (!wireframe)
 		EnableTextures(true);
 
@@ -223,6 +222,9 @@
 		glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
 	}
 
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_NORMAL_ARRAY);
+
 	if (!wireframe) {
 		glDisableClientState(GL_COLOR_ARRAY);
 		EnableTextures(false);




More information about the Bf-blender-cvs mailing list