Set GL pixel row alignment to be 1, not the default 4
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 9 Apr 2011 19:49:17 +0000 (19:49 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 9 Apr 2011 19:49:17 +0000 (19:49 +0000)
Fixes a few problems with non-multiple of 4 wide textures or
framebuffer, namely, skewed/corrupted textures in one case and memory
corruption when taking screenshots in the other.

git-svn-id: https://s.snth.net/svn/neverball/trunk@3570 78b8d119-cf0a-0410-b17c-f493084dd1d7

share/video.c

index 8d9b23a..b71cc95 100644 (file)
@@ -121,6 +121,9 @@ int video_mode(int f, int w, int h)
                       GL_SEPARATE_SPECULAR_COLOR);
         glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
 
+        glPixelStorei(GL_PACK_ALIGNMENT, 1);
+        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
         glDepthFunc(GL_LEQUAL);