PDA

View Full Version : Setting up vertex arrays - invalid state?



saluk
02-02-2003, 11:33 AM
I am having difficulty setting up the arrays for use with drawarrays/drawelements etc. When I try to use glTexCoordPointer, it is giving me an error that it is in an incorrect state to execute that gl command. I know you can execute this command between glBegin or glEnd, and you can't put it in a display list - what other states might it be incompatible with? It really seems like it should be working...

My guess was that this command is implemented incorrectly in pyOpenGL (python) but after scanning the documentation, I really do think I'm doing everything right. What could be wrong?

shinpaughp
02-02-2003, 02:45 PM
Don't know much about it, but did you use glEnableClientState(GL_TEXTURE_COORD_ARRAY) before your call to glTexCoordPointer? Call glDisableClientState(GL_TEXTURE_COORD_ARRAY) afterward.

Also, the blue book (OpenGL Reference Manual ver 1.2) states that glTexCoordPointer is NOT allowed between glBegin and glEnd and may or may not result in an error. But, if no error the operation is undefined (skipped).

[This message has been edited by shinpaughp (edited 02-02-2003).]

saluk
02-02-2003, 10:15 PM
Yeah, I've tried just about all the different combinations of order of the commands, using glEnableClientState(array) glArrayPointer(blah) then glDisableClientState(array). Still gave me the error. Oh well, I'll just use display lists for now, they seem to work pretty nicely on their own.

03-04-2003, 12:01 PM
the problem you might be having is executing any of the gl*Pointer commands between glBegin and glEnd, the only part of vertex arrays you can execute in a glBegin/end pair is glArrayElement