1GLSELECTBUFFER(3G) OpenGL Manual GLSELECTBUFFER(3G)
2
3
4
6 glSelectBuffer - establish a buffer for selection mode values
7
9 void glSelectBuffer(GLsizei size, GLuint * buffer);
10
12 size
13 Specifies the size of buffer.
14
15 buffer
16 Returns the selection data.
17
19 glSelectBuffer has two arguments: buffer is a pointer to an array of
20 unsigned integers, and size indicates the size of the array. buffer
21 returns values from the name stack (see glInitNames(), glLoadName(),
22 glPushName()) when the rendering mode is GL_SELECT (see
23 glRenderMode()). glSelectBuffer must be issued before selection mode
24 is enabled, and it must not be issued while the rendering mode is
25 GL_SELECT.
26
27 A programmer can use selection to determine which primitives are drawn
28 into some region of a window. The region is defined by the current
29 modelview and perspective matrices.
30
31 In selection mode, no pixel fragments are produced from rasterization.
32 Instead, if a primitive or a raster position intersects the clipping
33 volume defined by the viewing frustum and the user-defined clipping
34 planes, this primitive causes a selection hit. (With polygons, no hit
35 occurs if the polygon is culled.) When a change is made to the name
36 stack, or when glRenderMode() is called, a hit record is copied to
37 buffer if any hits have occurred since the last such event (name stack
38 change or glRenderMode() call). The hit record consists of the number
39 of names in the name stack at the time of the event, followed by the
40 minimum and maximum depth values of all vertices that hit since the
41 previous event, followed by the name stack contents, bottom name first.
42
43 Depth values (which are in the range [0,1]) are multiplied by 2 32 - 1,
44 before being placed in the hit record.
45
46 An internal index into buffer is reset to 0 whenever selection mode is
47 entered. Each time a hit record is copied into buffer, the index is
48 incremented to point to the cell just past the end of the block of
49 names\(emthat is, to the next available cell If the hit record is
50 larger than the number of remaining locations in buffer, as much data
51 as can fit is copied, and the overflow flag is set. If the name stack
52 is empty when a hit record is copied, that record consists of 0
53 followed by the minimum and maximum depth values.
54
55 To exit selection mode, call glRenderMode() with an argument other than
56 GL_SELECT. Whenever glRenderMode() is called while the render mode is
57 GL_SELECT, it returns the number of hit records copied to buffer,
58 resets the overflow flag and the selection buffer pointer, and
59 initializes the name stack to be empty. If the overflow bit was set
60 when glRenderMode() was called, a negative hit record count is
61 returned.
62
64 The contents of buffer is undefined until glRenderMode() is called with
65 an argument other than GL_SELECT.
66
67 glBegin()/glEnd() primitives and calls to glRasterPos() can result in
68 hits. glWindowPos() will always generate a selection hit.
69
71 GL_INVALID_VALUE is generated if size is negative.
72
73 GL_INVALID_OPERATION is generated if glSelectBuffer is called while the
74 render mode is GL_SELECT, or if glRenderMode() is called with argument
75 GL_SELECT before glSelectBuffer is called at least once.
76
77 GL_INVALID_OPERATION is generated if glSelectBuffer is executed between
78 the execution of glBegin() and the corresponding execution of glEnd().
79
81 glGet() with argument GL_NAME_STACK_DEPTH
82
83 glGet() with argument GL_SELECTION_BUFFER_SIZE
84
85 glGetPointerv() with argument GL_SELECTION_BUFFER_POINTER
86
88 glFeedbackBuffer(), glInitNames(), glLoadName(), glPushName(),
89 glRenderMode()
90
92 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
93 under the SGI Free Software B License. For details, see
94 http://oss.sgi.com/projects/FreeB/.
95
97 opengl.org
98
99
100
101opengl.org 06/10/2014 GLSELECTBUFFER(3G)