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/opengl1graphics.cpp | |
parent | 1f3217e483d05d4af612e8192598d7a0c111f93c (diff) | |
download | manaverse-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.gz manaverse-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.bz2 manaverse-cf542c3602eae931066d8b6e46d90109c8b2c13e.tar.xz manaverse-cf542c3602eae931066d8b6e46d90109c8b2c13e.zip |
Restore GL_PACK_ALIGNMENT after creating screenshots in opengl modes.
Diffstat (limited to 'src/opengl1graphics.cpp')
-rw-r--r-- | src/opengl1graphics.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index 1f1a0231d..e8c972522 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -474,6 +474,7 @@ SDL_Surface* OpenGL1Graphics::getScreenshot() { int h = mTarget->h; int w = mTarget->w; + GLint pack = 1; SDL_Surface *screenshot = SDL_CreateRGBSurface( SDL_SWSURFACE, @@ -484,6 +485,7 @@ SDL_Surface* OpenGL1Graphics::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); @@ -505,6 +507,8 @@ SDL_Surface* OpenGL1Graphics::getScreenshot() free(buf); + glPixelStorei(GL_PACK_ALIGNMENT, pack); + if (SDL_MUSTLOCK(screenshot)) SDL_UnlockSurface(screenshot); |