public void DrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color color) { drawActions.Enqueue(() => { const float kSegments = 16.0f; const int VertexCount = 16; var kIncrement = Settings.Tau / kSegments; var theta = 0.0f; GL.Color4(color.R, color.G, color.B, 0.5f); GL.Begin(PrimitiveType.TriangleFan); GL.VertexPointer(VertexCount * 2, VertexPointerType.Float, 0, IntPtr.Zero); for (var i = 0; i < kSegments; ++i) { var x = (float)Math.Cos(theta); var y = (float)Math.Sin(theta); var vertex = center + (radius * new Vec2(x, y)); GL.Vertex2(vertex.X, vertex.Y); theta += kIncrement; } GL.End(); DrawSegment(center, center + (radius * axis), color); }); }
public void DrawSegment(Vec2 p1, Vec2 p2, Color color) { drawActions.Enqueue(() => { GL.Color4(color.R, color.G, color.B, 1); GL.Begin(PrimitiveType.Lines); GL.Vertex2(p1.X, p1.Y); GL.Vertex2(p2.X, p2.Y); GL.End(); }); }
public void DrawSolidPolygon(Vec2[] vertices, int vertexCount, Color color) { drawActions.Enqueue(() => { GL.Color4(color.R, color.G, color.B, 0.5f); GL.Begin(PrimitiveType.TriangleFan); for (var i = 0; i < vertexCount; i++) { var vertex = vertices[i]; GL.Vertex2(vertex.X, vertex.Y); } GL.End(); }); }