This project has moved and is read-only. For the latest updates, please go here.

Drawing polygons.

Feb 24, 2011 at 1:53 PM
Edited Feb 24, 2011 at 1:53 PM

As the name states, I want to draw Fixtures with a polygon shape.

Only I can't get it to work... I am using this for now ->



            PolygonShape shape = (PolygonShape)_fixture.Shape;

            UtilDraw.DrawPolygon(shape.Vertices.ToArray(), shape.Vertices.Count, Color.White);


To draw it I use this ->



        static public void DrawPolygon(Vector2[] vertices,int count, Color col)

            for(int i = 0; i < count-1; i++)

                _vertices[_numvertices * 3].Position = new Vector3(vertices[0], 0);
                _vertices[_numvertices * 3].Color = col;

                _vertices[_numvertices * 3 + 1].Position = new Vector3(vertices[i ], 0);
                _vertices[_numvertices * 3 + 1].Color = col;

                _vertices[_numvertices * 3 + 2].Position = new Vector3(vertices[i + 1], 0);
                _vertices[_numvertices * 3 + 2].Color = col;




And it works and everything(Yeah I took some parts of it from your DebugDraw as I had no Idea how to draw textured triangles.).
Now my problem is that the vertices of the shape are not with the position or the rotation. 
How are you doing it? I looked trough the DebugDraw class and checked everywhere and I have no Idea how you are doing it! Thanks for any help. 
Feb 24, 2011 at 3:22 PM

Oups, it seemed I missed the DrawPolygon(Fixture f) function, now it works! I am sorry for the topic...