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 sh开发者_StackOverflow社区ape.
Surely others have encountered this need before? any tips would be appreciated :-)
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).
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.
精彩评论