I'm a beginner of OpenGL, this question confused me a long time.
Traditionaly, if we want set data to a buffer, we need to bind the buffer to a target, and then set data to the target. Like this:
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), data, GL_STATIC_DRAW);
I think it is counterintuitive.
If a Buffer represents a section of VRAM, set the buffer directly by the name of the buffer object is more natural.
Why OpenGL is designed to set data by binding buffer to target in the beginning?
I knew about glNamedBufferData()
when I search for this question, Why not use this function in the beginning?