diff --git a/Game/Game.cs b/Game/Game.cs index b1e0f023e..94fe213f7 100644 --- a/Game/Game.cs +++ b/Game/Game.cs @@ -10,7 +10,6 @@ using ClassicalSharp.Particles; using ClassicalSharp.Renderers; using ClassicalSharp.Selections; using OpenTK; -using OpenTK.Graphics.OpenGL; using OpenTK.Input; namespace ClassicalSharp { @@ -328,7 +327,7 @@ namespace ClassicalSharp { protected override void OnResize( EventArgs e ) { base.OnResize( e ); - GL.Viewport( ClientRectangle ); + Graphics.OnWindowResize( Width, Height ); UpdateProjection(); if( activeScreen != null ) { activeScreen.OnResize( width, height, Width, Height ); diff --git a/GraphicsAPI/IGraphicsApi.cs b/GraphicsAPI/IGraphicsApi.cs index 5e53456c7..c8fa532aa 100644 --- a/GraphicsAPI/IGraphicsApi.cs +++ b/GraphicsAPI/IGraphicsApi.cs @@ -196,6 +196,8 @@ namespace ClassicalSharp.GraphicsAPI { public virtual void PrintApiSpecificInfo() { } + public abstract void OnWindowResize( int newWidth, int newHeight ); + public virtual void Draw2DQuad( float x, float y, float width, float height, FastColour col ) { VertexPos3fCol4b[] vertices = { new VertexPos3fCol4b( x + width, y, 0, col ), diff --git a/GraphicsAPI/OpenGLApi.cs b/GraphicsAPI/OpenGLApi.cs index 04ddb88ca..b9109f6d9 100644 --- a/GraphicsAPI/OpenGLApi.cs +++ b/GraphicsAPI/OpenGLApi.cs @@ -618,6 +618,9 @@ namespace ClassicalSharp.GraphicsAPI { } } + public override void OnWindowResize( int newWidth, int newHeight ) { + GL.Viewport( 0, 0, newWidth, newHeight ); + } public Color4 GetCol() { float[] col = new float[4];