Renderer - Added 'SetViewportSize'

This commit is contained in:
miku-666
2024-02-11 19:58:15 +01:00
parent fdb8c56037
commit c6e800be63
3 changed files with 7 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
* 3. This notice may not be removed or altered from any source distribution.
**/
using System;
using System.Drawing;
using OpenTK.Graphics.OpenGL;
using PckStudio.Rendering.Shader;
@@ -30,5 +31,10 @@ namespace PckStudio.Rendering
context.IndexBuffer.Bind();
GL.DrawElements(context.PrimitiveType, context.IndexBuffer.GetCount(), DrawElementsType.UnsignedInt, 0);
}
public static void SetViewportSize(Size size)
{
GL.Viewport(size);
}
}
}

View File

@@ -78,6 +78,7 @@ namespace PckStudio.Rendering
Camera.ViewportSize = ClientSize;
Camera.Update();
}
Renderer.SetViewportSize(Camera.ViewportSize);
}
}
}

View File

@@ -676,8 +676,6 @@ namespace PckStudio.Rendering
MakeCurrent();
GL.Viewport(Size);
framebuffer.Bind();
GL.ClearColor(BackColor);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);