glTVControl = new GLControl(new OpenTK.Graphics.
GraphicsMode(32, 24, 8, 4));
// glTVControl.Dock = DockStyle.Fill;
glTVControl.Left = 400;
glTVControl.Top = 40;
glTVControl.Width = 400;
glTVControl.Height = 400;
this.Controls.Add(glTVControl);
private void SetupViewportOrthoGraphic(bool isTopView)
{
glTVControl.MakeCurrent();
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
if (isTopView)
{
// Orthographic Projection for Top View
// Orthographic projection for top view
GL.Ortho(-gridSize, gridSize, -gridSize, gridSize, -10, 10);
// GL.Ortho(-50, 50, -50, 50, -100, 100); // Left, Right, Bottom, Top,
Near, Far
}
else
{
// Perspective Projection for Normal View
float aspectRatio = Width / (float)Height;
Matrix4 perspective = Matrix4.CreatePerspectiveFieldOfView(
MathHelper.DegreesToRadians(45.0f), // Field of View
aspectRatio,
0.1f, // Near Clipping Plane
1000.0f // Far Clipping Plane
);
GL.LoadMatrix(ref perspective);
}