summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/opengl1graphics.cpp4
-rw-r--r--src/openglgraphics.cpp4
2 files changed, 8 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);
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);