Selection

Selection returns the current contents of the name stack, which is an array of names with integer values. You assign the names and build the name stack within the modeling code that specifies the geometry of objects you want to draw. Then, in selection mode, whenever a primitive intersects the clip volume, a selection hit occurs. The hit record, which is written into the selection array you've supplied with glSelectBuffer, contains information about the contents of the name stack at the time of the hit.

Note

Call glSelectBuffer before you put OpenGL into selection mode with glRenderMode. The entire contents of the name stack aren't guaranteed to be returned until you call glRenderMode to take OpenGL out of selection mode.

 

Manipulate the name stack with glInitNames, glLoadName, glPushName, and glPopName. You can also use gluPickMatrix for selection.