# Is it acceptable to buffer no data OpenGL?

Correct me if I am wrong, but if you call "glBufferData(...)" upon an existing buffer, it will resize the buffer to whatever data you upload.

Does that mean if I call something like

glBufferData(GL_ARRAY_BUFFER, 0, NULL, GL_DYNAMIC_DRAW);


it will keep the buffer in existence, but it will have size and no data?

In the description of glBufferData, it says it is acceptable to pass NULL as a data parameter, but it mentions nothing of the size parameter.

• What do you mean by "acceptable"? Seems like it would be easy to test if it's possible. Though I'm not sure why you'd want to do this. – MichaelHouse Dec 30 '13 at 20:45
• I want to do this for beacause A: when I assign actual data, I don't call genBuffers, B: I don't have needless data sitting on the GPU. I doubt it would break anything if I called it, but it may do something I malign which am unaware of, which is why I ask. – BWG Dec 30 '13 at 20:50

I have only seen this done with buffer orphaning. The idea is to manually map your buffer for use, this way as a user you know which portions of your buffer have been written and commit to the OpenGL driver. Once you run out of memory on your buffer you call glBufferData with a NULL parameter.