Search code examples
bufferopengl-4

Binding error with OpenGL buffers and Direct State Access (DSA)


I got this error from OpenGL when I use glNamedBufferStorage() :

GL_INVALID_OPERATION error generated. Buffer must be bound.

Normally I don't have to use glBindBuffer() with direct state access !?

Here is my gl call sequence :

glCreateBuffers(1, &m_identifier);
...
glNamedBufferStorage(m_identifier, static_cast< GLsizeiptr >(bytes + offset), data, GL_DYNAMIC_STORAGE_BIT);
...
glNamedBufferSubData(m_identifier, static_cast< GLintptr >(offset), static_cast< GLsizeiptr >(bytes), data);

I only use DSA functions, so I don't understand why I got the problem.


Solution

  • My bad, I forget this little one : glGetBufferParameteriv().

    Replaced by glGetNamedBufferParameteriv() in DSA.

    It was wrapped into a method of my class.