What's the meaning of doing that in OpenGL?
Does that reset all the names?
What's the meaning of doing that in OpenGL?
Does that reset all the names?
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html
It's used to push a new name onto the name stack (primarily used for mouse picking functionality). It will not clear the names, and you can go back to the previously set name by using glPopName.
EDIT: Out of curiosity, what are you using this for? That's a pretty old API, and I think it's been deprecated in OpenGL 3.0. If you're trying to do anything other than mouse picking then you may be using the wrong functions.
Yes, I want to use it for mouse picking,
What functions should I use?
In the last topic, I wasn't so clear and I did not post that I would like to know the meaning of glPushName( -1 )
What does that do?
glPushName() pushes new 'names' on the name stack when the current render mode is GL_SELECT. It was a crude API scheme to associate primitives (triangles, quads, triangle strips) with identifiers to be used for selection. As Toji said, these calls and associated state is deprecated in OpenGL 3.x, and unsupported when the GL_ARB_compatibility extension is absent. It wasn't really usable in the first place, since the minimum limit of supported names was only 64. If you need to "choose objects with the cursor", you should rather use color picking. Color picking is a technique where you render different primitives with different colors, and then read the color at the cursor position back. This can be done easily with gluPickMatrix() and glReadPixels(). Make sure only solid colors are rendered, which means no shading, lighting or texturing, and that dithering is disabled. Disable with glDisable(GL_DITHER)