OpenTK работа с матрицами(камера)
Я пытаюсь задать различные значения в функцию LookAt(), чтобы управлять камерой, но ничего не происходит. Какие бы значения я туда не кидал, камера остаётся в начальной точке и не двигается. Думаю, что я не правильно работаю с матрицами... Вот код метода:
private void OpenTkControl_OnGlRender(object sender, OpenTkControlBase.GlRenderEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
double halfWidth = e.Width / 2f;
double halfHeight = e.Height / 2f;
GL.Ortho(-halfWidth, halfWidth, -halfHeight, halfHeight, 10.0d, -10.0d);
GL.Viewport(0, 0, e.Width, e.Height);
float angle = (float)(80 * Math.PI / 180);
GL.MatrixMode(MatrixMode.Projection);
var p = Matrix4.CreatePerspectiveFieldOfView(angle, 1, 0.01f, 500);
GL.LoadMatrix(ref p);
GL.MatrixMode(MatrixMode.Modelview);
var view = Matrix4.LookAt(10, 30, 100, 0, 0, 0, 0, 1, 0);
GL.LoadMatrix(ref view);
if (_displayList <= 0 || e.NewContext)
{
_displayList = GL.GenLists(1);
GL.NewList(_displayList, ListMode.Compile);
GL.Color3(Color.Red);
painter.DrawPlace(-5.0d);
painter.DrawTube();
painter.DrawGrid();
painter.DrawProjection();
GL.EndList();
}
GL.Enable(EnableCap.Lighting);
GL.Enable(EnableCap.Light0);
GL.Enable(EnableCap.Blend);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
GL.Enable(EnableCap.DepthTest);
GL.ClearColor(Color.FromArgb(200, Color.LightBlue));
GL.Clear(ClearBufferMask.DepthBufferBit | ClearBufferMask.ColorBufferBit);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
_angle += 1f;
GL.Rotate(_angle, Vector3.UnitZ);
GL.Rotate(_angle, Vector3.UnitY);
GL.Rotate(_angle, Vector3.UnitX);
GL.Translate(0.5f, 0, 0);
GL.CallList(_displayList);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
Interlocked.Increment(ref _fps);
}