简体   繁体   English

凹面多边形绘图

[英]Concave polygon drawing

For drawing complex concave polygons with OpenGL, is it better to tesselate it into triangles, or use the stencil buffer ? 要使用OpenGL绘制复杂的凹多边形,最好将其镶嵌成三角形,还是使用模板缓冲区 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. 三角化多边形渲染速度更快,但一次性CPU成本较高,即三角测量本身。 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. 如果使用模板缓冲区方法而非大型多边形,则非常小的多边形成本要低得多,因为您可以将第二个渲染过程的大小限制为多边形的边界框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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