1GLUPICKMATRIX(3G) OpenGL Manual GLUPICKMATRIX(3G)
2
3
4
6 gluPickMatrix - define a picking region
7
9 void gluPickMatrix(GLdouble x, GLdouble y, GLdouble delX,
10 GLdouble delY, GLint * viewport);
11
13 x, y
14 Specify the center of a picking region in window coordinates.
15
16 delX, delY
17 Specify the width and height, respectively, of the picking region
18 in window coordinates.
19
20 viewport
21 Specifies the current viewport (as from a glGetIntegerv() call).
22
24 gluPickMatrix creates a projection matrix that can be used to restrict
25 drawing to a small region of the viewport. This is typically useful to
26 determine what objects are being drawn near the cursor. Use
27 gluPickMatrix to restrict drawing to a small region around the cursor.
28 Then, enter selection mode (with glRenderMode()) and rerender the
29 scene. All primitives that would have been drawn near the cursor are
30 identified and stored in the selection buffer.
31
32 The matrix created by gluPickMatrix is multiplied by the current matrix
33 just as if glMultMatrix() is called with the generated matrix. To
34 effectively use the generated pick matrix for picking, first call
35 glLoadIdentity() to load an identity matrix onto the perspective matrix
36 stack. Then call gluPickMatrix, and, finally, call a command (such as
37 gluPerspective()) to multiply the perspective matrix by the pick
38 matrix.
39
40 When using gluPickMatrix to pick NURBS, be careful to turn off the
41 NURBS property GLU_AUTO_LOAD_MATRIX. If GLU_AUTO_LOAD_MATRIX is not
42 turned off, then any NURBS surface rendered is subdivided differently
43 with the pick matrix than the way it was subdivided without the pick
44 matrix.
45
47 When rendering a scene as follows:
48
49 glMatrixMode(GL_PROJECTION);
50 glLoadIdentity();
51 gluPerspective(...);
52 glMatrixMode(GL_MODELVIEW);
53 /* Draw the scene */
54
55
56 a portion of the viewport can be selected as a pick region like this:
57
58 glMatrixMode(GL_PROJECTION);
59 glLoadIdentity();
60 gluPickMatrix(x, y, width, height, viewport);
61 gluPerspective(...);
62 glMatrixMode(GL_MODELVIEW);
63 /* Draw the scene */
64
65
66
68 gluPerspective(), glGet(), glLoadIdentity(), glMultMatrix(),
69 glRenderMode()
70
72 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
73 under the SGI Free Software B License. For details, see
74 http://oss.sgi.com/projects/FreeB/.
75
77 opengl.org
78
79
80
81opengl.org 07/13/2018 GLUPICKMATRIX(3G)