From 22e8c57a59b074db5beeb9f5b0a58a4455183d3b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Sep 2018 20:05:36 +0200 Subject: [PATCH] - reset the viewpoint buffer only once per scene, not per viewpoint. This doesn't work for camera textures because they are a separate viewpoint. --- src/gl/renderer/gl_renderer.cpp | 5 ++++- src/gl/scene/gl_scene.cpp | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 0bcdf7db6..d4b6197f9 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -135,6 +135,7 @@ FGLRenderer::~FGLRenderer() if (swdrawer) delete swdrawer; if (mBuffers) delete mBuffers; + if (mSaveBuffers) delete mSaveBuffers; if (mPresentShader) delete mPresentShader; if (mPresent3dCheckerShader) delete mPresent3dCheckerShader; if (mPresent3dColumnShader) delete mPresent3dColumnShader; @@ -221,6 +222,7 @@ sector_t *FGLRenderer::RenderView(player_t* player) P_FindParticleSubsectors(); mLights->Clear(); + mViewpoints->Clear(); // NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below. bool saved_niv = NoInterpolateView; @@ -322,7 +324,8 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i gl_RenderState.SetVertexBuffer(mVBO); mVBO->Reset(); mLights->Clear(); - + mViewpoints->Clear(); + // This shouldn't overwrite the global viewpoint even for a short time. FRenderViewpoint savevp; sector_t *viewsector = RenderViewpoint(savevp, players[consoleplayer].camera, &bounds, r_viewpoint.FieldOfView.Degrees, 1.6f, 1.6f, true, false); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 8c6b5ce39..1a83521f1 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -449,7 +449,6 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came // Render (potentially) multiple views for stereo 3d // Fixme. The view offsetting should be done with a static table and not require setup of the entire render state for the mode. auto vrmode = VRMode::GetVRMode(mainview && toscreen); - mViewpoints->Clear(); for (int eye_ix = 0; eye_ix < vrmode->mEyeCount; ++eye_ix) { const auto &eye = vrmode->mEyes[eye_ix];