ggggllllSSSSeeeelllleeeeccccttttBBBBuuuuffffffffeeeerrrr has two arguments: _b_u_f_f_e_r is a pointer to an array of
unsigned integers, and _s_i_z_e indicates the size of the array. _b_u_f_f_e_r
returns values from the name stack (see ggggllllIIIInnnniiiittttNNNNaaaammmmeeeessss, ggggllllLLLLooooaaaaddddNNNNaaaammmmeeee,
ggggllllPPPPuuuusssshhhhNNNNaaaammmmeeee) when the rendering mode is GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT (see ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee).
ggggllllSSSSeeeelllleeeeccccttttBBBBuuuuffffffffeeeerrrr must be issued before selection mode is enabled, and it
must not be issued while the rendering mode is GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT.
A programmer can use selection to determine which primitives are drawn
into some region of a window. The region is defined by the current
modelview and perspective matrices.
In selection mode, no pixel fragments are produced from rasterization.
Instead, if a primitive or a raster position intersects the clipping
volume defined by the viewing frustum and the user-defined clipping
planes, this primitive causes a selection hit. (With polygons, no hit
occurs if the polygon is culled.) When a change is made to the name
stack, or when ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee is called, a hit record is copied to _b_u_f_f_e_r
if any hits have occurred since the last such event (name stack change or
ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee call). The hit record consists of the number of names in
the name stack at the time of the event, followed by the minimum and
maximum depth values of all vertices that hit since the previous event,
followed by the name stack contents, bottom name first.
Depth values (which are in the range [0,1]) are multiplied by 2^32 - 1,
before being placed in the hit record.
An internal index into _b_u_f_f_e_r is reset to 0 whenever selection mode is
entered. Each time a hit record is copied into _b_u_f_f_e_r, the index is
incremented to point to the cell just past the end of the block of names
- that is, to the next available cell. If the hit record is larger than
the number of remaining locations in _b_u_f_f_e_r, as much data as can fit is
copied, and the overflow flag is set. If the name stack is empty when a
hit record is copied, that record consists of 0 followed by the minimum
To exit selection mode, call ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee with an argument other than
GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT. Whenever ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee is called while the render mode is
GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT, it returns the number of hit records copied to _b_u_f_f_e_r, resets
the overflow flag and the selection buffer pointer, and initializes the
name stack to be empty. If the overflow bit was set when ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee
was called, a negative hit record count is returned.
NNNNOOOOTTTTEEEESSSS
The contents of _b_u_f_f_e_r is undefined until ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee is called with an
argument other than GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT.
ggggllllBBBBeeeeggggiiiinnnn/ggggllllEEEEnnnndddd primitives and calls to ggggllllRRRRaaaasssstttteeeerrrrPPPPoooossss can result in hits.
EEEERRRRRRRROOOORRRRSSSS
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _s_i_z_e is negative.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ggggllllSSSSeeeelllleeeeccccttttBBBBuuuuffffffffeeeerrrr is called while the
render mode is GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT, or if ggggllllRRRReeeennnnddddeeeerrrrMMMMooooddddeeee is called with argument
GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTT before ggggllllSSSSeeeelllleeeeccccttttBBBBuuuuffffffffeeeerrrr is called at least once.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ggggllllSSSSeeeelllleeeeccccttttBBBBuuuuffffffffeeeerrrr is executed between
the execution of ggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of ggggllllEEEEnnnndddd.
ggggllllGGGGeeeetttt with argument GGGGLLLL____NNNNAAAAMMMMEEEE____SSSSTTTTAAAACCCCKKKK____DDDDEEEEPPPPTTTTHHHH
ggggllllGGGGeeeetttt with argument GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTTIIIIOOOONNNN____BBBBUUUUFFFFFFFFEEEERRRR____SSSSIIIIZZZZEEEE
ggggllllGGGGeeeettttPPPPooooiiiinnnntttteeeerrrrvvvv with argument GGGGLLLL____SSSSEEEELLLLEEEECCCCTTTTIIIIOOOONNNN____BBBBUUUUFFFFFFFFEEEERRRR____PPPPOOOOIIIINNNNTTTTEEEERRRR