Archived

This topic is now archived and is closed to further replies.

Will this cause an GL_INVALID_OPERATION??

This topic is 5503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Gang, I am trying to debug some code that seems like it''s giving me some problems. I am getting an GL_INVALID_OPERATION error when I stress out the system, and I can see it is happening around this block of code: glBegin(GL_LINE_STRIP); for (azListIter = arcVector_[index].listA_begin();, azListIter != arcVector_[index].listA_.end(); ++azListIter) { // create the XYZ point from the Az, El, // and range from the azListIter GlobeXYZ pt; createArcPoint(azListIter->az_, azListIter->el_, arcVector_[index].range_, pt); double vec[3]; pt.xyzVector(vec); glVertex3dv(vec); } glEnd(); Now, I have heard that nothing should go between a glBegin and a glEnd except for glVertex, glColor, glIndex, glNormal, glTexCoord, etc commands. Is this really true? Can I call regular C++ functions in between a glBegin and glEnd? Thanks for your help. I am a novice at this stuff. Roach

Share this post


Link to post
Share on other sites
Yes you can call C++ instructions.
The only forbidden commands are some GL commands.

Between glBegin and the corresponding glEnd, you can call glVertex, glColor etc, but you can also call a few other functions like glMaterial. To geta detailed list, go to www.opengl.org and download OpenGL 1.4 specifications and go to chapter 2.6.3 "GL Commands within Begin/End", page 19.

If you get an INVALID_OPERATION, that is not necessarily because of the last called GL command. Once an error occured, the GL remembers the error until the error flag is cleared when you call glGetError. That is, maybe the error returned by glGetError has been generated an hour ago !

Share this post


Link to post
Share on other sites