OpenGL顶点数组对象是存储顶点缓冲区名称和索引,还是仅存储索引? [英] Do OpenGL Vertex Array Objects store vertex buffer names and indices, or only indices?

查看:186
本文介绍了OpenGL顶点数组对象是存储顶点缓冲区名称和索引,还是仅存储索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建后,VAO是否仅跟踪VBO索引(通过 glBindVertexBuffer )哪些VBO名称绑定到这些索引?如果我在VAO创建过程中使用 glVertexAttribBinding 指定的绑定索引为0,我可以在绘制调用之前将另一个VBO绑定到索引0,并使其使用该VBO的内容,还是在创建VAO时始终使用绑定到索引0的任何VBO?

When created, do VAOs track just VBO indices (via glBindVertexBuffer), or also which VBO names are bound to those indices? If I specify a binding index of, say, 0 using glVertexAttribBinding during VAO creation, can I bind a different VBO to index 0 just prior to a draw call and have it use the contents of that VBO, or will it always use whatever VBO was bound to index 0 at the time the VAO was created?

我之所以问,是因为我找到了很多示例,这些示例是在 glVertexAttribFormat 调用的href =" https://www.opengl.org/wiki/GLAPI/glVertexAttribBinding"rel =" nofollow> glVertexAttribBinding ,如果VAO仅跟踪索引(因为绑定索引是在glVertexAttribBinding中给出的.)

I ask because a lot of examples I find precede calls to glVertexAttribFormat and glVertexAttribBinding with a call to glBindVertexBuffer, which should not be necessary if the VAO tracks only indices (since the binding index is given in glVertexAttribBinding).

推荐答案

答案是,它们不存储顶点名称,仅存储索引.如果将另一个VBO绑定到另一个VAO中的相同索引,则必须在使用第一个VAO的glDraw调用之前再次重新绑定第一个VBO.

The answer is that they DO NOT store vertex names, only indices. If you bind a different VBO to the same index in a different VAO, you must re-bind the first VBO again before any glDraw call that uses the first VAO.

至少在我的Macbook Pro上具有:

At least on my Macbook Pro with:

渲染器:NVidia GeForce GT 650M OpenGL引擎

Renderer: NVidia GeForce GT 650M OpenGL Engine

版本:4.1 NVIDIA-10.0.43 310.41.05f01

Version: 4.1 NVIDIA-10.0.43 310.41.05f01

这篇关于OpenGL顶点数组对象是存储顶点缓冲区名称和索引,还是仅存储索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆