OpenGL Vertex Array/Buffer Objects

Posted by sadanjon on Stack Overflow See other posts from Stack Overflow or by sadanjon
Published on 2012-11-12T10:52:36Z Indexed on 2012/11/12 11:00 UTC
Read the original article Hit count: 210

Filed under:

Question 1

Do vertex buffer objects created under a certain VAO deleted once that VAO is deleted?

An example:

glGenBuffers(1, &bufferObject);
glGenVertexArrays(1, &VAO);

glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, bufferObject);
glBufferData(GL_ARRAY_BUFFER, sizeof(someVertices), someVertices, 
             GL_STATIC_DRAW);
glEnableVertexAttribArray(positionAttrib);
glVertexAttribPointer(positionAttrib, 3, GL_FLOAT, GL_FALSE, 0, NULL);

When later calling glDeleteVertexArrays(1, &VAO);, will bufferObject be deleted as well?

The reason I'm asking is that I saw a few examples over the web that didn't delete those buffer objects.

Question 2

What is the maximum amount of memory that I can allocate for buffer objects? It must be system dependent of course, but I can't seem find an estimation for it. What happens when video RAM isn't big enough? How would I know?

© Stack Overflow or respective owner