opengl着色器中的多边形细分
我想要在 opengl 中渲染 20k+ 2D 多边形,并带有轮廓和轮廓。充满。
有些多边形是凹的。
是否可以使用着色器来做到这一点?
I want 20k+ 2D polygons to be rendered in opengl with outline & fill.
Some polygons are concave.
Is it possible to do this using shaders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,您不需要着色器:
如果多边形是凹面,您必须手动或使用 gl 实用程序库 glu 对它们进行细分。看看
gluNewTess
。如果您决定自己对多边形进行细分,则必须记住设置正确的边缘标志,以便不会渲染细分的内部边缘,请参阅glEdgeFlagPointer
。编辑:我找到了以下链接 关于如何使用模板缓冲区渲染凹多边形。
You don't need shaders for this:
If the polygons are concave you'll have to tesselate them, either manually or using the gl utility library, glu. Look at
gluNewTess
. If you decide to tesselate the polygons yourself you'll have to remember to set the correct edge flags so that the interior edges of the tesselation aren't rendered, seeglEdgeFlagPointer
.EDIT: I found the following link on how to use the stencil buffer to render concave polygons.