hello,
i am using glOrtho for 2D Projection (LineDrawing) and glFrustion for Perspective Projection (ArcBall/TrackBall), My Problem is the distorting von the View in Case of GlFrustum.
the problem i think i know, but no solution for that
The Following Code I am Using:
############
void Render()
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
// line
if (LineDraw != null)
{
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, game.Width, game.Height, 0, 0, 1);
GL.LineWidth(2.5f);
GL.Color3(1.0f, 1.0f, 1.0f);
GL.Begin(PrimitiveType.Lines);
ListCollection<Vector2> points = LineDraw.Points;
for (int i = 0; i < points.Size() - 1; i++)
{
GL.Vertex2(points.Get(i).X, points.Get(i).Y);
GL.Vertex2(points.Get(i + 1).X, points.Get(i + 1).Y);
}
GL.End();
}
// trackball
if (TrackBall != null)
{
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Frustum(0, game.Width, game.Height, 0, 0, 1);
GL.MultMatrix(TrackBall.GetRoationMatrix().Mat);
DrawUtils.Rotate(rotate_x, rotate_y);
GL.Begin(PrimitiveType.Lines);
GL.Color4(1.0, 0.0, 0.0, 1.0);
GL.Vertex3(0.0, 0.0, 0.0);
GL.Vertex3(10.0, 0.0, 0.0);
GL.Color4(0.0, 1.0, 0.0, 1.0);
GL.Vertex3(0.0, 0.0, 0.0);
GL.Vertex3(0.0, 10.0, 0.0);
GL.Color4(0.0, 0.0, 1.0, 1.0);
GL.Vertex3(0.0, 0.0, 0.0);
GL.Vertex3(0.0, 0.0, 10.0);
GL.End();
DrawUtils.DrawBox();
}
}
Thanks alot.
pradox