PDA

View Full Version : glVertexAttribPointer causing problems



tamato
05-05-2011, 05:21 PM
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

mobeen
05-06-2011, 10:58 AM
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);
glutInitMode(..);
glutInitWindowSize(w,h);
glutCreateWindow("title");

glutDisplayFunc(...);
//attach other callbacks

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

tamato
05-06-2011, 11:40 AM
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.

Dan Bartlett
05-06-2011, 12:14 PM
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.

tamato
05-06-2011, 01:13 PM
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?

Dan Bartlett
05-06-2011, 02:18 PM
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.

tamato
05-06-2011, 03:52 PM
got it in, and it works like a charm.

Thank you