glPushName + glPopName stack overflow and underflow
Can anybody explain me how to use glPushName and glPopName. I like to u开发者_如何学编程se them instead of glLoadName, but I laways get GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW errors. (First, under then overflow).
Example code would help me too.
Note #1: My Rendering/selection_rednering code consists of multiple glBegin(...)/glEnd() blocks, if this is any problem plus various Rotations and Transformations.
Note #2: I know that GL selection / picking is deprecated, but I have to implement it within a Application which was developed a with OpenGL2.1 a while ago.
In this case I was just dumb, because that stackoverflow was caused by doing to much glPushMatrix, as that stack has a very low capacity (3 in my special hardware case). Drawing mode worked just fine, but I have an additional Matrix used for picking mode.
How to use glPopName /glPushName(name)
glPushName(obj->name());
glBegin(...);
//draw it;
glEnd();
glPushName(obj->child->name());
glBegin(...);
//draw child it;
glEnd();
glPopName();
glPopName(); //important, or yoou will get a stackoverflow after some time
精彩评论