public virtual void Paint(OpenGLControlWrapper w) { var eye = new Vector3(0f, 0f, 0f); var target = (Lookat - Eye).ToNear(); var up = new Vector3(Up.ToFloat()); ViewMatrix = Matrix4.LookAt(eye, target, up); //todo //Console.WriteLine(ViewMatrix); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref ViewMatrix); PaintInternal(w); w.SwapBuffers(); }
public override void Paint(OpenGLControlWrapper w) { var e = MathHelper.DegreesToRadians(Elevation); var a = MathHelper.DegreesToRadians(Azimuth); var z = (float)Math.Sin(e); var d = Math.Cos(e); var x = (float)(Math.Cos(a) * d); var y = (float)(Math.Sin(a) * d); var target = new Vector3(x, y, z); var eye = new Vector3(0f, 0f, 0f); var up = new Vector3(0f, 0f, 1f); ViewMatrix = Matrix4.LookAt(eye, target, up); GL.MatrixMode(MatrixMode.Modelview); // This worked with the lookat in s/c frame GL.LoadMatrix(ref ViewMatrix); Satellite.Attitude.ToAxisAngle(out Vector3 axis, out float angle); GL.Rotate(angle * 180.0f / 3.141593f, axis); PaintInternal(w); w.SwapBuffers(); }