Joel Martinez
Joel Martinez

Reputation: 47749

Render arbitrary polygon with XNA

Looking for a simple way to render a list of arbitrary vertices (on a 2d plane) ... I'm guessing that I'll have to do some sort of tessellation, and will have to deal with concave/convex polygons. Not looking for a crazy visualization here ... just want to render a flat shape.

Surely others have encountered this need before? any tips would be appreciated :-)

Upvotes: 3

Views: 1239

Answers (2)

Factor Mystic
Factor Mystic

Reputation: 26770

Depending on how simple you need to go, you can check out this Primitives Sample on msdn. It's ripped out of the SpaceWar sample and should get you started with basic primitives.

Upvotes: 0

Andrew Russell
Andrew Russell

Reputation: 27215

You're actually after triangulation.

Try Nick Gravelyn's Triangulator library. Last time I used it there was a bug in that some polygons would triangulate inside-out. But if you poke around the bug tracker I think there's a fix there (perhaps this one).

Upvotes: 2

Related Questions