简体   繁体   中英

Concave polygon drawing

For drawing complex concave polygons with OpenGL, is it better to tesselate it into triangles, or use the stencil buffer ? I'm guessing the stencil buffer would be faster for a single frame, but triangulation would be better for multiple frames if the polygon doesn't change. However, I haven't actually tried it, so I don't know.

It's exactly the way you said it:

Triangulated polygons render faster but have a high one-time CPU cost, namely the triangulation itself. In my experience it pays off to triangulate the polygons if you have to render it at least twice.

The size of the polygon makes a difference though. Very small polygons cost much less if you use the stencil buffer method than large polygons because you can restrict the size of the second rendering pass to the boundary box of the polygon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM