diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index d83581249..81cbd7eeb 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -470,16 +470,16 @@ void OpenGLFrameBuffer::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, int sx = u * viewport.width; int sy = v * viewport.height; int sindex = (sx + sy * viewport.width) * 3; - int dindex = (x + y * w) * 3; + int dindex = (x + (h - y - 1) * w) * 3; ScreenshotBuffer[dindex] = pixels[sindex]; ScreenshotBuffer[dindex + 1] = pixels[sindex + 1]; ScreenshotBuffer[dindex + 2] = pixels[sindex + 2]; } } - pitch = -w*3; + pitch = w * 3; color_type = SS_RGB; - buffer = ScreenshotBuffer + w * 3 * (h - 1); + buffer = ScreenshotBuffer; // Screenshot should not use gamma correction if it was already applied to rendered image EXTERN_CVAR(Bool, fullscreen); diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index a220b0a34..898820cc9 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -64,7 +64,6 @@ public: bool HWGammaActive = false; // Are we using hardware or software gamma? std::shared_ptr mDebug; // Debug API private: - uint8_t *ScreenshotBuffer; // What the name says. This must be maintained because the software renderer can return a locked canvas surface which the caller cannot release. int camtexcount = 0; class Wiper