问题
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