i am trying to add the ability to resize the app window without causing the contents of the window to stretch at the same time. i have tried changing the if statements and tried different ratio calculations to no affect
protected override void OnResize(EventArgs e) { base.OnResize(e); if (mShader != null) { int uProjectionLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uProjection"); int windowHeight = ClientRectangle.Height; int windowWidth = ClientRectangle.Width; if (windowHeight > windowWidth) { if (windowWidth < 1) { windowWidth = 1; } float ratio = windowWidth / windowHeight; Matrix4 projection = Matrix4.CreateOrthographic(ratio * 10, ratio * 10, -1, 1); GL.UniformMatrix4(uProjectionLocation, true, ref projection); } else if(windowHeight < windowWidth) { if (windowHeight < 1) { windowHeight = 1; } float ratio = windowWidth / windowHeight; Matrix4 projection = Matrix4.CreateOrthographic(ratio * 10, ratio * 10, -1, 1); GL.UniformMatrix4(uProjectionLocation, true, ref projection); } } GL.Viewport(this.ClientRectangle); }