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.

This commit is contained in:
Mitchell Stokes 2012-11-22 06:11:05 +00:00
parent b7f5c1c121
commit 6577117c4e

@ -95,35 +95,29 @@ static void DisableForText()
{
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);
}
}