summaryrefslogtreecommitdiff
path: root/src/opengl1graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-12-26 01:35:34 +0300
committerAndrei Karas <akaras@inbox.ru>2011-12-26 01:35:34 +0300
commitcf542c3602eae931066d8b6e46d90109c8b2c13e (patch)
tree9e12421ad033cb0247a30b170487732fd2db2cb6 /src/opengl1graphics.cpp
parent1f3217e483d05d4af612e8192598d7a0c111f93c (diff)
downloadplus-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/opengl1graphics.cpp')
-rw-r--r--src/opengl1graphics.cpp4
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);