Opengl Vertex Array Objects

*爱你&永不变心* 提交于 2019-12-11 00:38:55

问题


Are OpenGL's Vertex Array Objects stored in VRam?

What I'm really asking: If I load a model, using Assimp for example, then read the vertex and indice data into Vertex Array Objects; will I be duplicating data in Ram, or copying it to the GPU?


回答1:


There seems to be a lack of understanding of OpenGL terminology here.

You cannot read "vertex and indice data" into Vertex Array Objects. They don't actually store the data; the arrays of data are stored in buffer objects. VAOs only reference them. VAOs describe how the data in those buffers is formatted so that OpenGL can understand what they mean.

If you are asking about client-side vertex arrays (note the lack of the word "object", though you can use client-side vertex arrays with VAOs), then by definition they are not stored on the GPU. The "client" of client-side vertex arrays is the user's code. IE: memory you allocated, own, and manage.

If you're asking about the use of buffer objects, yes, buffer object storage resides on the "server" (ie: memory owned by the OpenGL implementation). Whether it's actually physically on the GPU at any particular point in time is not something you can determine. But after you call glBufferData, glBufferSubData, or other such functions that update buffer objects, the server has copied that data.



来源:https://stackoverflow.com/questions/12868994/opengl-vertex-array-objects

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!