OpenGL - VBO 内的顶点数组以及索引和索引纹理数组在外面?
是否可以将一组顶点放入 VBO 中,但采用索引和纹理坐标。来自常规内存的数组?如果是,使用哪种语法?
Is it possible to place a set of Vertices into a VBO, but take the Index and Texture coord. Arrays from regular memory? If yes, which syntax to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可以做到的。但你不应该。
使用缓冲区对象的原因是为了提高性能。执行您的建议只会降低通过正确使用缓冲区对象获得的性能。
而且,这是大多数驾驶员不常看到的驾驶员路径。人们要么使用缓冲区对象来存储顶点数据,要么使用客户端内存数组。由于这是一条人迹罕至的道路,因此您更有可能遇到驱动程序错误。
语法只是常规语法。
gl*Pointer
调用是否使用缓冲区对象取决于缓冲区对象是否在gl*Pointer
时绑定到GL_ARRAY_BUFFER
> 已拨打电话。因此,您可以将缓冲区绑定到GL_ARRAY_BUFFER
,使用偏移量进行gl*Pointer
调用,然后将 0 绑定到GL_ARRAY_BUFFER
并进行使用实际指针调用gl*Pointer
。同样,如果缓冲区绑定到
GL_ELEMENT_ARRAY_BUFFER
,则glDraw*Elements*
调用将使用缓冲区对象。因此,如果您想将客户端内存用于这些功能,请将 0 绑定到该内存。Yes, it is possible to do this. But you shouldn't.
The reason to use buffer objects is to improve performance. Doing what you suggest simply reduces the performance you would have gained by properly using buffer objects.
Also, it's a driver path that most drivers don't see very often. Either people use buffer objects for vertex data, or they use client memory arrays. Since it's a road less traveled, you're more likely to encounter driver bugs.
The syntax is just the regular syntax. The
gl*Pointer
calls use buffer objects or not based on whether a buffer object is bound toGL_ARRAY_BUFFER
at the time thegl*Pointer
call is made. As such, you can bind a buffer toGL_ARRAY_BUFFER
, make agl*Pointer
call with an offset, then bind 0 toGL_ARRAY_BUFFER
and make agl*Pointer
call with an actual pointer.Similarly, the
glDraw*Elements*
calls use a buffer object if a buffer is bound toGL_ELEMENT_ARRAY_BUFFER
. So if you want to use client memory for these functions, bind 0 to that.