Reputation: 190
I am having a hard time understanding what exactly is meant by state. I have read about vertex array objects (VAOs) and vertex buffer objects (VBOs) and as well as context creation. So far i have understood that context is the state of everything associated with the instance of OpenGL that you have created.
I have also understood that a VAO is a reference to the names you created which OpenGL allocated and VBO is the data of those VAOs. However, in the OpenGL red book it says that when you create a VBO that OpenGL allocates a state to the VBO which you obviously have to bind to the VAO.
What I don't understand is relationship between the objects and the context. If the context is supposed to be the state of the OpenGL instance, why does it create additional states which it allocates to the vertex buffer object? Whenever you call some function that changes that state of the context, it actually changes the VBO and not the actual default state of the context.
Have I understood this correctly or am I confusing something here?
Upvotes: 0
Views: 317
Reputation: 10049
The OpenGL context contains all state within your OpenGL instance. The VBOs and VAOs are sub-states within that 'global' state. They cannot exist outside of the GL context (although you could potentially share them with other contexts). When you perform operations on either a VBO or VAO, you are modifying the state of the VBO/VAO, which is a part of the GL context, thus you are modifying it as well.
Upvotes: 0