public static void DrawCircle(Circle circle, Color color)
 {
     GLUtil.SetColor(color);
     Gl.glBegin(Gl.GL_LINE_LOOP);
     PlotCircleVertices(circle.X, circle.Y, circle.Radius);
     Gl.glEnd();
 }
        public static void DrawSquare(double x, double y, double dimension, Color color)
        {
            double halfDimension = dimension / 2;

            GLUtil.SetColor(color);
            Gl.glBegin(Gl.GL_LINES);
            {
                // Top left to top right
                Gl.glVertex2d(x - halfDimension, y + halfDimension);
                Gl.glVertex2d(x + halfDimension, y + halfDimension);

                // Top right to bottom right
                Gl.glVertex2d(x + halfDimension, y + halfDimension);
                Gl.glVertex2d(x + halfDimension, y - halfDimension);

                // Bottom right to bottom left
                Gl.glVertex2d(x + halfDimension, y - halfDimension);
                Gl.glVertex2d(x - halfDimension, y - halfDimension);

                // Bottom left to top left
                Gl.glVertex2d(x - halfDimension, y - halfDimension);
                Gl.glVertex2d(x - halfDimension, y + halfDimension);
            }
            Gl.glEnd();
        }
        public void DrawTriangles(Color color)
        {
            GLUtil.SetColor(color);

            foreach (Triangle triangle in _indexedTriMesh)
            {
                DrawTriangle(color, triangle.A, triangle.B, triangle.C);
                DrawTriangleCentroid(color, triangle);
            }
        }
 public void DrawNodePaths(Color color)
 {
     GLUtil.SetColor(color);
     foreach (NavNode startNode in _allNodes)
     {
         foreach (NavNode endNode in startNode.Links)
         {
             PrimitiveDrawer.DrawLine2d(startNode.Position, endNode.Position);
         }
     }
 }
 internal static void DrawFilledCircle(Point point, double radius, Color color)
 {
     GLUtil.SetColor(color);
     Gl.glBegin(Gl.GL_TRIANGLE_FAN);
     {
         Gl.glVertex2d(point.X, point.Y);
         PlotCircleVertices(point.X, point.Y, radius);
         Gl.glVertex2d(point.X + radius * Math.Cos(0), point.Y + radius * Math.Sin(0));
     }
     Gl.glEnd();
 }
        public static void DrawPolygon(Polygon polygon, Color color)
        {
            GLUtil.SetColor(color);
            Gl.glBegin(Gl.GL_LINE_STRIP);
            {
                foreach (Point p in polygon)
                {
                    Gl.glVertex2d(p.X, p.Y);
                }
            }
            Point point = polygon.VertexList.First();

            Gl.glVertex2d(point.X, point.Y);
            Gl.glEnd();
        }
        public static void DrawCrosshair(double x, double y, double dimension, Color color)
        {
            double halfDimension = dimension / 2;

            GLUtil.SetColor(color);
            Gl.glBegin(Gl.GL_LINES);
            {
                // Left to right
                Gl.glVertex2d(x - halfDimension, y);
                Gl.glVertex2d(x + halfDimension, y);

                // Top to bottom
                Gl.glVertex2d(x, y + halfDimension);
                Gl.glVertex2d(x, y - halfDimension);
            }
            Gl.glEnd();
        }
        public static void DrawFilledPolygon(Polygon polygon, Color color)
        {
            Triangulator tr = new Triangulator(polygon.VertexList.ToArray());

            int[] indices = tr.Triangulate();


            GLUtil.SetColor(color);
            Gl.glBegin(Gl.GL_TRIANGLES);
            {
                foreach (int index in indices)
                {
                    Point p = polygon.VertexList[index];
                    Gl.glVertex2d(p.X, p.Y);
                }
            }
            Gl.glEnd();
        }
        public void Render()
        {
            foreach (PolyVertex v in _vertexList)
            {
                PrimitiveDrawer.DrawSquare(v.Point.X, v.Point.Y, v.Tween.Value(), new Color(1, 0, 0, 1));
            }

            PrimitiveDrawer.DrawDashedCircle(_hightLightCircle, new Color(1, 0, 0, 1));

            Gl.glBegin(Gl.GL_LINE_STRIP);
            {
                foreach (PolyVertex v in _vertexList)
                {
                    GLUtil.DrawPointVertex(v.Point);
                }
            }
            Gl.glEnd();
        }