diff --git a/GUI/Controls/GLViewerControl.cs b/GUI/Controls/GLViewerControl.cs index 643446d41..f68d2598a 100644 --- a/GUI/Controls/GLViewerControl.cs +++ b/GUI/Controls/GLViewerControl.cs @@ -375,7 +375,6 @@ private static void OnDebugMessage(DebugSource source, DebugType type, int id, D public Framebuffer GLDefaultFramebuffer; public Framebuffer MainFramebuffer; - public Framebuffer FinalFramebuffer; private int MaxSamples; private int NumSamples => Math.Max(1, Math.Min(Settings.Config.AntiAliasingSamples, MaxSamples)); @@ -529,10 +528,13 @@ private void Draw() } } - MainFramebuffer.Bind(FramebufferTarget.ReadFramebuffer); - GLDefaultFramebuffer.Bind(FramebufferTarget.DrawFramebuffer); + if (MainFramebuffer != GLDefaultFramebuffer) + { + MainFramebuffer.Bind(FramebufferTarget.ReadFramebuffer); + GLDefaultFramebuffer.Bind(FramebufferTarget.DrawFramebuffer); - FramebufferBlit(MainFramebuffer, GLDefaultFramebuffer); + FramebufferBlit(MainFramebuffer, GLDefaultFramebuffer); + } if (Settings.Config.DisplayFps != 0) { diff --git a/GUI/Types/Renderer/GLTextureViewer.cs b/GUI/Types/Renderer/GLTextureViewer.cs index 590ac34e1..52ee4ccec 100644 --- a/GUI/Types/Renderer/GLTextureViewer.cs +++ b/GUI/Types/Renderer/GLTextureViewer.cs @@ -471,7 +471,7 @@ protected override SKBitmap ReadPixelsToBitmap() } finally { - FinalFramebuffer.Bind(FramebufferTarget.Framebuffer); + MainFramebuffer.Bind(FramebufferTarget.Framebuffer); bitmap?.Dispose(); } } @@ -835,18 +835,17 @@ private void OnLoad(object sender, EventArgs e) GL.CreateVertexArrays(1, out vao); // Use non-msaa framebuffer for texture viewer - if (FinalFramebuffer != GLDefaultFramebuffer) + if (MainFramebuffer != GLDefaultFramebuffer) { - FinalFramebuffer.Dispose(); - FinalFramebuffer = GLDefaultFramebuffer; + MainFramebuffer.Dispose(); + MainFramebuffer = GLDefaultFramebuffer; } - FinalFramebuffer.ClearColor = OpenTK.Graphics.Color4.Green; - FinalFramebuffer.ClearMask = ClearBufferMask.ColorBufferBit; + MainFramebuffer.ClearColor = OpenTK.Graphics.Color4.Green; + MainFramebuffer.ClearMask = ClearBufferMask.ColorBufferBit; GL.DepthMask(false); GL.Disable(EnableCap.DepthTest); - GL.Disable(EnableCap.CullFace); GLLoad -= OnLoad; @@ -903,8 +902,8 @@ private void OnPaint(object sender, RenderEventArgs e) TextureScaleChangeTime += e.FrameTime; GL.Viewport(0, 0, GLControl.Width, GLControl.Height); - FinalFramebuffer.Clear(); - Draw(FinalFramebuffer); + MainFramebuffer.Clear(); + Draw(MainFramebuffer); } private void Draw(Framebuffer fbo, bool captureFullSizeImage = false)