- 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.
This commit is contained in:
Christoph Oelckers 2014-09-21 21:01:11 +02:00
parent b2cf7d6512
commit 48da2f87bb
1 changed files with 3 additions and 1 deletions

View File

@ -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<ADynamicLight> it(STAT_DLIGHT);