I am doing instancing in opengl using vbos to store the per frame data (like matrix, color tint, etc.). I have a vbo per vao to store the instance data. Then each render batch (use same shader, vao etc.) in the frame I use the glBufferData call to update the data. However I realised if the same vao occurs in more then one render batch, i use the same vbo that might have already been used for a previous render batch.
It hasn't seemed to matter, , however thought it might just be reading out of invalid memory, but from reading this
, Opengl generates a new one until the frame is over (I call SwapBuffers).
Whenever you see either of these, think of it as a directive to OpenGL to 1) detach the old block of storage and 2) give you a new block of storage to work with, all behind the same buffer handle. The old block of storage will be put on a free list by OpenGL and reused once there can be no draw commands in the queue which might be referring to it (e.g. once all queued GL commands have finished executing).
I was wondering if this is a bad idea to be relying on opengl to do this and should I be managing a list of available vbos in a linked list or something like this? something that I guess is happening behind the scenes in Opengl.