diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 1f937be55..5ccacf305 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -260,7 +260,7 @@ void FGLRenderer::TonemapScene() // //----------------------------------------------------------------------------- -void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds) +void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma) { if (FGLRenderBuffers::IsEnabled()) { @@ -338,7 +338,7 @@ void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds) mPresentShader->Bind(); mPresentShader->InputTexture.Set(0); - if (framebuffer->IsHWGammaActive()) + if (!applyGamma || framebuffer->IsHWGammaActive()) { mPresentShader->Gamma.Set(1.0f); mPresentShader->Contrast.Set(1.0f); diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index 3fd2afa86..78eac4cbf 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -160,8 +160,8 @@ public: void EndDrawScene(sector_t * viewsector); void BloomScene(); void TonemapScene(); - void CopyToBackbuffer(const GL_IRECT *bounds); - void Flush() { CopyToBackbuffer(nullptr); } + void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma); + void Flush() { CopyToBackbuffer(nullptr, true); } void SetProjection(float fov, float ratio, float fovratio); void SetProjection(VSMatrix matrix); // raw matrix input from stereo 3d modes diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 734257c8c..87197d09d 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -858,7 +858,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo clipper.SafeAddClipRangeRealAngles(ViewAngle.BAMs() + a1, ViewAngle.BAMs() - a1); ProcessScene(toscreen); - if (mainview) EndDrawScene(retval); // do not call this for camera textures. + if (mainview && toscreen) EndDrawScene(retval); // do not call this for camera textures. if (mainview) { if (FGLRenderBuffers::IsEnabled()) mBuffers->BlitSceneToTexture(); @@ -976,7 +976,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei gl_RenderState.SetSoftLightLevel(-1); screen->Begin2D(false); DrawBlend(viewsector); - CopyToBackbuffer(&bounds); + CopyToBackbuffer(&bounds, false); glFlush(); byte * scr = (byte *)M_Malloc(width * height * 3);