コード例 #1
0
        // Renders a triangle with the given triangle and color
        public virtual void renderTriangle(Triangle triangle, Color color)
        {
            // Variables
            Point3[]	endpoints=	triangle.getEndpoints();

            GL.Disable(EnableCap.Texture2D);

            GL.Begin(PrimitiveType.Triangles);
            {
                GL.Color4(color.red, color.green, color.blue, color.alpha);

                // Triangle ABC
                GL.Vertex3(endpoints[0].x, endpoints[0].y, endpoints[0].z);
                GL.Vertex3(endpoints[1].x, endpoints[1].y, endpoints[1].z);
                GL.Vertex3(endpoints[2].x, endpoints[2].y, endpoints[2].z);
            }
            GL.End();

            GL.Enable(EnableCap.Texture2D);
        }
コード例 #2
0
 // Renders the endpoints of a triangle with the given triangle, color, and point size
 public virtual void renderTriangleEndpoints(Triangle triangle, Color color, float pointSize)
 {
     renderEndpoints(triangle.getEndpoints(), color, pointSize);
 }
コード例 #3
0
        // Renders the outline of a triangle with the given triangle, color, and line width
        public virtual void outlineTriangle(Triangle triangle, Color color, float lineWidth)
        {
            // Variables
            Point3[]	endpoints=	triangle.getEndpoints();

            GL.Disable(EnableCap.Texture2D);
            GL.LineWidth(lineWidth);

            GL.Begin(PrimitiveType.Lines);
            {
                GL.Color4(color.red, color.green, color.blue, color.alpha);

                // Line AB
                GL.Vertex3(endpoints[0].x, endpoints[0].y, endpoints[0].z);
                GL.Vertex3(endpoints[1].x, endpoints[1].y, endpoints[1].z);

                // Line BC
                GL.Vertex3(endpoints[1].x, endpoints[1].y, endpoints[1].z);
                GL.Vertex3(endpoints[2].x, endpoints[2].y, endpoints[2].z);

                // Line CA
                GL.Vertex3(endpoints[2].x, endpoints[2].y, endpoints[2].z);
                GL.Vertex3(endpoints[0].x, endpoints[0].y, endpoints[0].z);
            }
            GL.End();

            GL.LineWidth(1f);
            GL.Enable(EnableCap.Texture2D);

            renderEndpoints(endpoints, color, lineWidth);
        }