glVertexAttribPointer causing problems

I’m using an Integrated AMD Radeon HD 6310 card on a Win7 x64 machine.
It has the latest drivers (cat 11.4)

and since this is an AMD card I have generated and bound a VAO at the start of my application.

The problem is, everytime glVertexAttribPointer is called it gives a GL_INVALID_OPERATION error.

The only thing I’ve found to get ride of the error so far was to create and bind a new vao just before calling any methods that modify a vertex array. I know this is the wrong way, and will not be doing that.

I’ve also create a individual VAO for each object I was drawing but then, glBindVertexArray was giving a GL_INVALID_OPERATION error.

Can anyone help with this?

Thank you

R u creating the vao before the context is created. Make sure that you are creating the vao after the context is created. So typically on glut, the calls are roughly like this,

void main(int argc, char** argv) {
   glutInit(&argc, argv);

   //attach other callbacks

   OnInit(); //this is where u should initialize the vao.

That’s actually a possibility. I’ve been looking for where the contexts are being created and no luck yet.

I’m working from an existing code base where glut is not being used, and multiple contexts are being used. We have multiple screens and each screen has it’s own context.

VAOs aren’t shared across contexts, so if you’re just generating + binding a VAO at the start, then I guess you’ll need to do this for each context.

Just to be clear, if I gen/bind a vao to each context and start switching contexts would I have to bind the vao’s to each context again?

No, once you’ve generated a VAO in each context + bound it to the context it was created in, it should stay bound to that context even if you switch contexts.

got it in, and it works like a charm.

Thank you