Are VBOs only for OpenGL 3.x?
I'm using immediate mode and I know it's bad, slow, and deprecated. But then I looked at display lists but they are deprecated too. I guess the VBO is the only one left so is it only for OpenGL 3.x?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
Vertex Buffer Objects are basically an evolution of ATi's original Vertex Array Object extension. That extension has the unfortunate honor of sharing its name with a completely different concept by the same name in modern OpenGL. In fact, Buffer Objects now describe a generic source of dedicated server (GPU) storage. You can use this memory for vertices, indices, textures, uniforms, transform feedback, pixel transfer, and so on in modern GL.
Prior to Vertex Buffer Objects, vertex memory was transferred from client (CPU)->server (GPU) everytime you called
glDrawArrays (...). That is because GL did not own the memory referenced by vertex array pointers, and the CPU and GPU generally operate asynchronously with potentially many frames queued up in advance. Since the CPU could modify vertex memory at any time without the GPU's knowledge, implementations either had to copy data immediately when
glDraw* (...) was called or block the CPU until vertex processing finished. Many attempts were made to address this issue over the years, including things like NVIDIA's Vertex Array Range, which allocated special memory for DMA data transfer. However, ultimately VBOs were the only real way to solve it.
VBOs plug that hole by making the only way to access vertex memory by using GL commands. Now GL knows anytime memory is changed and does not have to waste time copying data for every draw command.
VBOs have been available since OpenGL 1.4 as an extension and were added to the core in OpenGL 1.5. You can use either version depending on your needs, if you strictly want to use OpenGL 3.1 with the core profile only, then VBOs are your only option.
If you want to use compatibility profile, you can always use the deprecated functions. Keep in mind that "deprecated" only means that it might be removed from the standard, but no major vendors have plans drop support for it.
No, VBOs are not only for
3.x, they are 3.x+ (including 4.x) and even back to the 2.x specification at least, probably earlier. It's safe to assume that any platform supporting OpenGL will (likely) support at-least 2.1, so you'd be safe to use buffer objects if your worried about gpu support (and maintaining code.)
VAOs are a bit of a different story, they weren't around in 2.1, and are required with 3.x+ core profiles (though not necessarily with a compatibility profile.)
If you feel to bad about using Immediate-Mode, and don't want to switch, you could probably find/create an API that has the Immediate-Mode functions but renders the primitives using the newer API versions. That wouldn't be the suggested rout though.