OpenGL - 当为 VAO 设置索引缓冲区时,我可以绘制非索引吗?
我设置了一个 VAO,将顶点缓冲区绑定到它以获取顶点属性,同时还设置了索引缓冲区(使用 glVertexArrayElementBuffer)。这是否会限制它,使其仅适用于 glDrawElements
类型的命令,还是也适用于 glDrawArrays
? (使用OpenGL4.5)
I set up a VAO, binding vertex-buffers to it for vertex attributes, but also set index-buffer (With glVertexArrayElementBuffer
). Does that restrict it so it only works with glDrawElements
type of commands, or will it work with glDrawArrays
too?
(Using OpenGL4.5)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,
您仍然可以使用非索引绘制调用,例如 glDrawArrays。问题是你的顶点拓扑是否适合。 glDrawArrays 本质上等于索引为 [0, 1, 2, 3, 4, 5, ...] 的索引绘制调用。
No.
You can still use non-indexed draw calls like glDrawArrays. The question is whether your vertex topology suits that. glDrawArrays is essentially equal to an indexed draw call with indices [0, 1, 2, 3, 4, 5, ...].