summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openglgraphics.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 84f499a4..e2fd9397 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -660,6 +660,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
{
int h = mTarget->h;
int w = mTarget->w;
+ GLint pack = 1;
SDL_Surface *screenshot = SDL_CreateRGBSurface(
SDL_SWSURFACE,
@@ -670,6 +671,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);
@@ -689,6 +691,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
free(buf);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack);
+
if (SDL_MUSTLOCK(screenshot))
SDL_UnlockSurface(screenshot);