
Aspect ratio problem by using Matrix
Posted Sunday, 27 June, 2010 - 16:36 by jjgl| Project: | The Open Toolkit library |
| Version: | 1.0.0-rc1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I am using OpenTK in my project and have difficulty to use OpenTK.Math.Matrix4.Perspective() dealing with aspect ratio problem. The following Resize function is not working. Could anyone tell me what I have missed here?
private void glControl1_Resize(object sender, EventArgs e)
{
if (!left_glcontrol_loaded)
{
return;
}
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Matrix4 m_prespective = Matrix4.Perspective(45.0f, (float) glControl1.Width/ (float)glControl1.Height, 1.0f, 400.0f);
GL.LoadMatrix(ref m_prespective);
}


Comments
#11
Need to change ymax in gluPerspective() as ymax = zNear * Math.Tan(fovy * Math.PI / 180.0); to make display right. Thank you all!
#12