From 48da2f87bbba5beae46c89b865e43c551929338a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Sep 2014 21:01:11 +0200 Subject: [PATCH] - fixed: The light buffer index must not be reset between rendering a camera texture and the main scene. Since rendering is asynchronous, the camera texture scene may not be finished once the main scene's lights get filled in. Unfortunately forcing a synchronization with glFinisg has bad side effects on performance the only remaining option is to use separate parts of the buffer for both scenes, which in extreme cases may increase the light buffer's size - but on modern hardware that shouldn't be a problem. --- src/gl/scene/gl_scene.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index b095d261b..eed892c6f 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -798,7 +798,6 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo SetCameraPos(viewx, viewy, viewz, viewangle); SetViewMatrix(false, false); gl_RenderState.ApplyMatrices(); - GLRenderer->mLights->Clear(); clipper.Clear(); angle_t a1 = FrustumAngle(); @@ -845,6 +844,8 @@ void FGLRenderer::RenderView (player_t* player) P_FindParticleSubsectors (); + GLRenderer->mLights->Clear(); + // prepare all camera textures that have been used in the last frame FCanvasTextureInfo::UpdateAll(); @@ -896,6 +897,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei SetFixedColormap(player); gl_RenderState.SetVertexBuffer(mVBO); GLRenderer->mVBO->Reset(); + GLRenderer->mLights->Clear(); // Check if there's some lights. If not some code can be skipped. TThinkerIterator it(STAT_DLIGHT);