GL_INVALID_OPERATION in glVertexAttribPointer

Hi,

glGetError returns GL_INVALID_OPERATION after the following sequence:


glBindVertexArray(1);
glDisableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,0);
glVertexAttribPointer(1,0,GL_FLOAT,false,0,0x0000);

I am not sure why it is happening considering the SDK for glVertexAttribPointer says:

GL_INVALID_OPERATION is generated if zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.

In this case, both GL_ARRAY_BUFFER and pointer are null. I suppose the call is not necessary, and I should just call glDisableVertexAttribArray.

Also, I doubt this is the problem, but I am using GLIntercept, and read “OpenGL3.0 + pure core profiles do not work correctly (will be fixed).”

I am using GL 3.3 core profile and tested on both NVIDIA and ATI so I think this is my fault, not a driver issue.

Regards,
Patrick

It is definitely true that the DisableVertexAttribArray would be enough.

Also, the GL_ARB_vertex_array_object spec says the following:

An INVALID_OPERATION error is generated if VertexAttribPointer or VertexAttribIPointer is called while a non-zero vertex array object is bound and zero is bound to the ARRAY_BUFFER buffer object binding point.

So the error code seems to be valid here.

Good eye. I thought the VAO may have something to do with it, but I expected to see VAO restrictions in the SDK page for glVertexAttribPointer. Next time, I’ll check both.

Thanks!
Patrick

With pleasure!

Actually it wouldn’t have been that easy to find if I would have not checked that extension specification just yesterday because I read the issues part :smiley: