Skip to content

Commit

Permalink
Second attempt at fixing skewed textures.
Browse files Browse the repository at this point in the history
Fixes issue #346, which reported that the skewed textures occured if the
game was toggled between fullscreen and windowed, or if the resolution
changed. The GL_PACK_ALIGNMENT/GL_UNPACK_ALIGNMENT values needed to be
set before ContextInitializer::executeInitFuncs(), or else affected
textures would be skewed upon context re-creation. The moves the calls
to glPixelStorei setting the alignment into the
OpenGLGState::initGLState() function.
  • Loading branch information
blast007 committed Jun 16, 2024
1 parent c0e7b28 commit 2711356
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ogl/OpenGLGState.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1362,8 +1362,6 @@ void OpenGLGState::initContext()
glLoadIdentity();
glEnable(GL_SCISSOR_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glPixelStorei(GL_PACK_ALIGNMENT,1);
}


Expand All @@ -1388,6 +1386,9 @@ void OpenGLGState::initGLState()
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glPixelStorei(GL_PACK_ALIGNMENT,1);
}

// utility to check if an OpenGL extension is supported on this system
Expand Down

0 comments on commit 2711356

Please sign in to comment.