public void Draw(Camera camera) { Matrix4 lookat = camera.View; GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref lookat); GL.Disable(EnableCap.CullFace); GL.Disable(EnableCap.Texture2D); GL.Disable(EnableCap.Lighting); GL.Disable(EnableCap.Light0); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); GL.Begin(PrimitiveType.Quads); GL.Color4(0f, 1.0f, 0f, 1.0f); GL.Vertex3(-1.0f, 0, -1.0f); GL.Vertex3( 0, 0, -1.0f); GL.Vertex3( 0, 0, 0); GL.Vertex3(-1.0f, 0, 0); GL.Vertex3(0, 0, -1.0f); GL.Vertex3(1.0f, 0, -1.0f); GL.Vertex3(1.0f, 0, 0); GL.Vertex3(0, 0, 0); GL.Vertex3(-1.0f, 0, 0); GL.Vertex3(0, 0, 0); GL.Vertex3(0, 0, 1.0f); GL.Vertex3(-1.0f, 0, 1.0f); GL.Vertex3(0, 0, 0); GL.Vertex3(1.0f, 0, 0); GL.Vertex3(1.0f, 0, 1.0f); GL.Vertex3(0, 0, 1.0f); GL.End(); if (bb != null) { bb.Draw(); } GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.FrontFace(frontFace); Lights(); foreach (var model in models) { model.Draw(); } foreach (var entity in entities) { entity.Draw(); } }
public Viewport() { camera = new Camera() { ProjectionMode = mode, Zoom = 2 }; tw = new TextWriter(vw, vh, 50, 20); }