[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52460] trunk/blender/source/gameengine/ BlenderRoutines/KX_BlenderGL.cpp: BGE: Removing some glIsEnabled() calls from DisableForText() in KX_BlenderGL.cpp.

Mitchell Stokes mogurijin at gmail.com
Thu Nov 22 07:11:07 CET 2012


Revision: 52460
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52460
Author:   moguri
Date:     2012-11-22 06:11:05 +0000 (Thu, 22 Nov 2012)
Log Message:
-----------
BGE: Removing some glIsEnabled() calls from DisableForText() in KX_BlenderGL.cpp. Use of glIsEnabled() is discouraged since it causes a potential sync with the graphics card. Also, it's faster to just always use glDisable() (even if that feature is already disabled) then to check if it's enabled first.

Modified Paths:
--------------
    trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp

Modified: trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
===================================================================
--- trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp	2012-11-22 06:04:12 UTC (rev 52459)
+++ trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp	2012-11-22 06:11:05 UTC (rev 52460)
@@ -95,35 +95,29 @@
 {
 	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
 
-	if (glIsEnabled(GL_BLEND)) glDisable(GL_BLEND);
-	if (glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST);
+	glDisable(GL_BLEND);
+	glDisable(GL_ALPHA_TEST);
 
-	if (glIsEnabled(GL_LIGHTING)) {
-		glDisable(GL_LIGHTING);
-		glDisable(GL_COLOR_MATERIAL);
-	}
+	glDisable(GL_LIGHTING);
+	glDisable(GL_COLOR_MATERIAL);
 
 	if (GLEW_ARB_multitexture) {
 		for (int i=0; i<MAXTEX; i++) {
 			glActiveTextureARB(GL_TEXTURE0_ARB+i);
 
 			if (GLEW_ARB_texture_cube_map)
-				if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
-					glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-			if (glIsEnabled(GL_TEXTURE_2D))
-				glDisable(GL_TEXTURE_2D);
+			glDisable(GL_TEXTURE_2D);
 		}
 
 		glActiveTextureARB(GL_TEXTURE0_ARB);
 	}
 	else {
 		if (GLEW_ARB_texture_cube_map)
-			if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
-				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+			glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-		if (glIsEnabled(GL_TEXTURE_2D))
-			glDisable(GL_TEXTURE_2D);
+		glDisable(GL_TEXTURE_2D);
 	}
 }
 




More information about the Bf-blender-cvs mailing list