예제 #1
0
        public void FillPolygon(GsColor color, GsVector[] pts)
        {
            SwitchMode(Mode.Primitives);
            var indices = Ratcliff.Triangulate(pts).Select(i => (short)i).ToArray();

            primitiveBatch.DrawIndexed(PrimitiveType.TriangleList, indices,
                                       pts.Select(p => CreateVertex(color, p)).ToArray());
        }
예제 #2
0
        public void FillPolygon(GsColor color, GsVector[] pts)
        {
            using (AlphaBlend(color))
            {
                var indices = Ratcliff.Triangulate(pts);
                GL.Begin(PrimitiveType.Triangles);
                GL.Color4(color.R, color.G, color.B, color.A);
                int i = 0;
                while (i < indices.Length)
                {
                    var p1 = pts[indices[i++]];
                    var p2 = pts[indices[i++]];
                    var p3 = pts[indices[i++]];

                    GL.Vertex2(p1.X, p1.Y);
                    GL.Vertex2(p2.X, p2.Y);
                    GL.Vertex2(p3.X, p3.Y);
                }
                GL.End();
            }
        }