Should I remove the "Vertex Buffer Object" after binding it to Vertex Array objects?

I created VBO (vertex buffer object) and VAO (vertex array objects) and did this:

glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(...); glVertexAttribPointer(...); glEnableVertexAttribArray(0); glBindVertexArray(0); 

Is it possible to remove vbo after that and then do it with vao if everything is okay?

I know that buffers are bound to vao , so I guess I can.

The problem is that if I delete the buffer on my computer (Intel graphics), it works fine (everything displays correctly), but nothing appears on my other computer (AMD).

What could be the problem?

(By the way, if I do not delete the buffers, the program works both on my computer and on my friend)

+7
c ++ opengl
source share
1 answer

Yes, according to OpenGL 4.5, it is legal to delete it after untying the VAO.

2.6.1.2 Delete names and delete objects

If an object is deleted when it is currently in use by the GL context, its name is immediately marked as unused, and some types of objects are automatically unbound from anchor points in the current context, as described in section 5.1.2. However, the actual base object is not deleted until it is no longer used. This situation is discussed in more detail in section 5.1.3.

5.1.2 Automatically detaching deleted objects

When a buffer, texture, or rendering object is deleted, it is not associated with any anchor points that are anchored in the current context and separated from any attachments of container objects anchored to the current context, as described for DeleteBuffers, DeleteTextures, and DeleteRenderbuffers. [...] Attachments to an unbound container objects, such as removing a buffer attached to a vertex array object that is not context related, are not affected and continue to act as references to the deleted object , as described in the next section.

5.1.3 Remote object and object names

When a buffer, texture, sampler, rendering, query, or synchronization object is deleted, its name immediately becomes invalid (for example, it is marked not used), but the main object will not be deleted until it is no longer used .

A buffer, texture, sampler, or renderbuffer object is used if one of the following conditions is true:

  • an object is bound to any container object
  • [...]

So, either this is an AMD driver error, or the situation is not the same as you describe.

+6
source share

All Articles