glVertexAttribPointer causes INVALID_VALUE error in OpenGL 4.0?

I’m porting some code to OpenGL 4, and have run into trouble with my vertex buffers. My same OpenGL 2 code is producing an INVALID_VALUE error after a call to glVertexAttribPointer().

At the beginning of my program, I set up one vertex array object to be shared across vertex buffers:

        GLuint vao;

And then my code to enable the vertex buffer looks like this:


Are there any common known issues when transitioning from OpenGL 2 to OpenGL 4 that could explain this? Thanks.

Ah. I think the problem was that vertex array objects are not shared across contexts.

vertex array objects are not shared across contexts

I believe that is correct.