退化三角形和 GL_TRIANGLE_STRIP 的问题
我正在尝试仅通过一次调用 glDrawElements
来绘制多个三角形带,我对此事的研究告诉我,我需要使用退化三角形。也许我对这个问题的理解是错误的,但我认为这应该允许我从一个地带“跳”到另一个地带。
我的完整代码可以在我最近发布的这个问题上找到,如果您认为相关,请查看那里。
我基本上是想用 4 个三角形绘制 2 个四边形(为了简化目的),但彼此分开。为此,我使用这样的索引:
unsigned int indices[] = { 0, 256, 1, 257, 257, 2, 2, 258, 3, 259 };
第一个条带的第一个顶点从 0 开始,第二个条带的第一个顶点从 256 开始。这是该索引的最终结果:
这是正确的还是我认为“连接”2 个四边形的线根本不应该在那里?
I'm trying to draw multiple triangle strips with only one call to glDrawElements
and my research on the matter tells me I need to use degenerate triangles. Maybe my understanding on the subject is wrong but I thought this should allow me to "jump" from a strip to another.
My whole code for this can be found on this recent question I posted, take a look there if you think it's relevant.
I'm basically trying to draw 2 quads(for simplification purposes) with 4 triangles of course, but separated from each other. For that I use indices like this:
unsigned int indices[] = { 0, 256, 1, 257, 257, 2, 2, 258, 3, 259 };
The first vertex of the first strip starts at 0 and the first vertex of the second strip starts at 256. This is the end result of this indices:
Is this correct or am I right in thinking that line "connecting" the 2 quads shouldn't be there at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显示的图像是正确的。这个技巧不适用于线框。如果您绘制实心三角形,面积为零的三角形将不会显示,但您正在绘制轮廓。
The image shown is correct. This trick doesn't work for wireframes. If you were drawing filled triangles, the triangle with zero area wouldn't show up, but you're drawing outlines.