假设我使用新的(从 OpenGL 4.3 开始)glBindVertexBuffer 机制设置了两个 VAO:
glGenVertexArrays(1, &vaoIndex0);
glGenVertexArrays(1, &vaoIndex1);
...
glBindVertexArray(vaoIndex0)
glBindVertexBuffer(bindingIndex0, ...)
glEnableVertexAttribArray(0)
glVertexAttribFormat(0, ...)
glVertexAttribBinding(0, bindingIndex0)
...
glBindVertexArray(0)
...
glBindVertexArray(vaoIndex1)
glBindVertexBuffer(bindingIndex1, ...)
glEnableVertexAttribArray(0)
glVertexAttribFormat(0, ...)
glVertexAttribBinding(0, bindingIndex1)
...
glBindVertexArray(0)
并假设两者是独立的,除非它们存在于相同的 OpenGL 上下文中;它们绑定不同的缓冲区,并将用于绘制不同的东西。
bindingIndex0 是否需要与 bindingIndex1 不同?两个指数的相等(或不相等)有什么意义吗?
...
编辑:
收到答案后,我开始明白,对于真正知道“顶点缓冲区绑定点”是什么的人,特别是它的范围是什么,我的问题似乎是在问一些与我的意图不同的东西。也许更好的措辞是“为了防止冲突,是否需要不遗余力地防止 OpenGL 顶点缓冲区绑定点索引被重用,甚至跨多个 VAO 重用?” 但无论如何,现在似乎这两个问题都得到了回答:不,你不能重用“绑定点”,不,你不需要以这种方式避免索引冲突。