diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index f1a8f9003c..e223bb9b8c 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -70,8 +70,6 @@ public: SWSceneDrawer *swdrawer = nullptr; - float mSceneClearColor[3]; - FGLRenderer(OpenGLFrameBuffer *fb); ~FGLRenderer() ; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 6f1b561993..520c8b7920 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -223,7 +223,7 @@ void FGLRenderer::Set3DViewport() // This is faster on newer hardware because it allows the GPU to skip // reading from slower memory where the full buffers are stored. glDisable(GL_SCISSOR_TEST); - glClearColor(mSceneClearColor[0], mSceneClearColor[1], mSceneClearColor[2], 1.0f); + glClearColor(screen->mSceneClearColor[0], screen->mSceneClearColor[1], screen->mSceneClearColor[2], screen->mSceneClearColor[3]); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); const auto &bounds = screen->mSceneViewport; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index f2d352c7dc..c20d727efa 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -131,8 +131,6 @@ void OpenGLFrameBuffer::InitializeState() gl_PrintStartupLog(); } - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClearDepth(1.0f); glDepthFunc(GL_LESS); glEnable(GL_DITHER); @@ -145,6 +143,8 @@ void OpenGLFrameBuffer::InitializeState() glDisable(GL_LINE_SMOOTH); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SetViewportRects(nullptr); @@ -415,15 +415,6 @@ void OpenGLFrameBuffer::UpdatePalette() // //=========================================================================== -void OpenGLFrameBuffer::SetClearColor(int color) -{ - PalEntry pe = GPalette.BaseColors[color]; - GLRenderer->mSceneClearColor[0] = pe.r / 255.f; - GLRenderer->mSceneClearColor[1] = pe.g / 255.f; - GLRenderer->mSceneClearColor[2] = pe.b / 255.f; -} - - void OpenGLFrameBuffer::BeginFrame() { SetViewportRects(nullptr); diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index 11ce2c590b..59f2fd30e8 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -27,7 +27,6 @@ public: void CleanForRestart() override; void UpdatePalette() override; - void SetClearColor(int color) override; uint32_t GetCaps() override; void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV) override; void WriteSavePic(player_t *player, FileWriter *file, int width, int height) override; diff --git a/src/v_framebuffer.cpp b/src/v_framebuffer.cpp index d39f395792..c89d3cf8a8 100644 --- a/src/v_framebuffer.cpp +++ b/src/v_framebuffer.cpp @@ -324,6 +324,14 @@ void DFrameBuffer::GetFlash(PalEntry &rgb, int &amount) amount = Flash.a; } +void DFrameBuffer::SetClearColor(int color) +{ + PalEntry pe = GPalette.BaseColors[color]; + mSceneClearColor[0] = pe.r / 255.f; + mSceneClearColor[1] = pe.g / 255.f; + mSceneClearColor[2] = pe.b / 255.f; + mSceneClearColor[3] = 1.f; +} //========================================================================== // diff --git a/src/v_video.h b/src/v_video.h index fffe8c0063..8d73560130 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -389,6 +389,8 @@ public: IntRect mScreenViewport; IntRect mSceneViewport; IntRect mOutputLetterbox; + float mSceneClearColor[4]; + public: DFrameBuffer (int width=1, int height=1); @@ -493,7 +495,7 @@ public: // Report a game restart void InitPalette(); - virtual void SetClearColor(int color) {} + void SetClearColor(int color); virtual uint32_t GetCaps(); virtual void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV); virtual void WriteSavePic(player_t *player, FileWriter *file, int width, int height);