GL Renderer: Remove erroneous glEnable(GL_TEXTURE_2D) calls

In OpenGL 3, texturing is always enabled, and this call is invalid.
While it produced no effect in the rest of the execution, it wouldn't
have the intended effect of disabling texturing for that unit. Instead
bind a null texture to the unit.
master
Yuri Kunde Schlesner 2015-07-22 01:22:09 +07:00
parent d0b45d45b5
commit e5c4fe0098
1 changed files with 5 additions and 8 deletions

@ -147,19 +147,16 @@ void OpenGLState::Apply() {
// Textures // Textures
for (unsigned texture_index = 0; texture_index < ARRAY_SIZE(texture_units); ++texture_index) { for (unsigned texture_index = 0; texture_index < ARRAY_SIZE(texture_units); ++texture_index) {
if (texture_units[texture_index].enabled_2d != cur_state.texture_units[texture_index].enabled_2d) { if (texture_units[texture_index].enabled_2d != cur_state.texture_units[texture_index].enabled_2d ||
texture_units[texture_index].texture_2d != cur_state.texture_units[texture_index].texture_2d) {
glActiveTexture(GL_TEXTURE0 + texture_index); glActiveTexture(GL_TEXTURE0 + texture_index);
if (texture_units[texture_index].enabled_2d) { if (texture_units[texture_index].enabled_2d) {
glEnable(GL_TEXTURE_2D);
} else {
glDisable(GL_TEXTURE_2D);
}
}
if (texture_units[texture_index].texture_2d != cur_state.texture_units[texture_index].texture_2d) {
glActiveTexture(GL_TEXTURE0 + texture_index);
glBindTexture(GL_TEXTURE_2D, texture_units[texture_index].texture_2d); glBindTexture(GL_TEXTURE_2D, texture_units[texture_index].texture_2d);
} else {
glBindTexture(GL_TEXTURE_2D, 0);
}
} }
} }