Jump to content
  • Advertisement
Sign in to follow this  

OpenGL glBindBuffer zero target valid?

This topic is 2121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I usually bind the zero target after doing some operation to a buffer. The purpose is to catch errors. Is this a reasonable strategy?


Does it have any performance problems?


Running gDEBugger, it tells me that glBindBuffer(XXX, 0) is deprecated:



The function glBindBuffer uses an object that was not generated by OpenGL. This feature was marked as deprecated in OpenGL version 3.0 and was removed from OpenGL at version 3.1


Looking at the OpenGL specification, it looks like 0 is allowed:



The value zero is reserved, but there is no default buffer object for each buffer object target. Instead, buffer? set to zero effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target (if supported for that target).






While buffer object name zero is bound, as in the initial state, attempts to modify or query state on the target to which it is bound generates an GL_INVALID_OPERATION? error.






Share this post

Link to post
Share on other sites

Seems like a gDEBugger issue with not correctly identify this case.

if you're concerned about performance issues , you could #ifdef that zero-buffer-binding line to only run in debug mode . This way you will have the behavior when running in debug mode, which will allow you to check for issues, and when you're sure you have none, you won't need to unbind buffers anymore.


As for the actual performance delta, ALWAYS MEASURE. Just run a test scene, that will stress that particular binding/unbinding part of your code with both that line and without it and time the difference. As a friend, if they have a different video card, to run the same test and compare the data. Repeat the test lots of times, for consistency. After that, take the decision based on those numbers.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!