diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 518c35934..7a961d2cd 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -810,6 +810,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo mViewActor=camera; } + // 'viewsector' will not survive the rendering so it cannot be used anymore below. retval = viewsector; // Render (potentially) multiple views for stereo 3d @@ -838,7 +839,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo clipper.SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1); ProcessScene(toscreen); - EndDrawScene(viewsector); + if (mainview) EndDrawScene(retval); // do not call this for camera textures. eye->TearDown(); } stereo3dMode.TearDown();