diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-12-26 01:35:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-12-26 01:35:34 +0300 |
commit | cf542c3602eae931066d8b6e46d90109c8b2c13e (patch) | |
tree | 9e12421ad033cb0247a30b170487732fd2db2cb6 /src/openglgraphics.cpp | |
parent | 1f3217e483d05d4af612e8192598d7a0c111f93c (diff) | |
download | plus-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.gz plus-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.bz2 plus-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.xz plus-cf542c3602eae931066d8b6e46d90109c8b2c13e.zip |
Restore GL_PACK_ALIGNMENT after creating screenshots in opengl modes.
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r-- | src/openglgraphics.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index f5e9f8107..a8eb5d010 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -1020,6 +1020,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot() { int h = mTarget->h; int w = mTarget->w; + GLint pack = 1; SDL_Surface *screenshot = SDL_CreateRGBSurface( SDL_SWSURFACE, @@ -1033,6 +1034,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot() SDL_LockSurface(screenshot); // Grap the pixel buffer and write it to the SDL surface + glGetIntegerv(GL_PACK_ALIGNMENT, &pack); glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels); @@ -1054,6 +1056,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot() free(buf); + glPixelStorei(GL_PACK_ALIGNMENT, pack); + if (SDL_MUSTLOCK(screenshot)) SDL_UnlockSurface(screenshot); |