pickmatrix.3gl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. '\" e
  2. '\"! eqn | mmdoc
  3. '\"macro stdmacro
  4. .ds Vn Version 1.2
  5. .ds Dt 6 March 1997
  6. .ds Re Release 1.2.0
  7. .ds Dp May 02 11:53
  8. .ds Dm 37 pickmatri
  9. .ds Xs 64359 5 pickmatrix.gl
  10. .TH GLUPICKMATRIX 3G
  11. .SH NAME
  12. .B "gluPickMatrix
  13. \- define a picking region
  14. .SH C SPECIFICATION
  15. void \f3gluPickMatrix\fP(
  16. GLdouble \fIx\fP,
  17. .nf
  18. .ta \w'\f3void \fPgluPickMatrix( 'u
  19. GLdouble \fIy\fP,
  20. GLdouble \fIdelX\fP,
  21. GLdouble \fIdelY\fP,
  22. GLint \fI*viewport\fP )
  23. .fi
  24. .EQ
  25. delim $$
  26. .EN
  27. .SH PARAMETERS
  28. .TP \w'\f2x\fP\ \f2y\fP\ \ 'u
  29. \f2x\fP, \f2y\fP
  30. Specify the center of a picking region in window coordinates.
  31. .TP
  32. \f2delX\fP, \f2delY\fP
  33. Specify the width and height, respectively, of the picking region in window
  34. coordinates.
  35. .TP
  36. \f2viewport\fP
  37. Specifies the current viewport (as from a \f3glGetIntegerv\fP call).
  38. .SH DESCRIPTION
  39. \%\f3gluPickMatrix\fP creates a projection matrix that can be used to restrict drawing
  40. to a small region of the viewport.
  41. This is typically useful to
  42. determine what objects are being drawn near the cursor.
  43. Use \%\f3gluPickMatrix\fP to
  44. restrict drawing to a small region around the cursor.
  45. Then,
  46. enter selection mode (with \f3glRenderMode\fP) and rerender the scene.
  47. All primitives that would have been drawn near
  48. the cursor are identified and stored in the selection buffer.
  49. .P
  50. The matrix created by \%\f3gluPickMatrix\fP is multiplied by the current matrix just
  51. as if \f3glMultMatrix\fP is called with the generated matrix.
  52. To effectively use the generated pick matrix for picking,
  53. first call \f3glLoadIdentity\fP to load an identity matrix onto the
  54. perspective matrix stack.
  55. Then call \%\f3gluPickMatrix\fP,
  56. and finally, call a command (such as \%\f3gluPerspective\fP)
  57. to multiply the perspective matrix by the pick matrix.
  58. .P
  59. When using \%\f3gluPickMatrix\fP to pick NURBS, be careful to turn off the NURBS
  60. property
  61. \%\f3GLU_AUTO_LOAD_MATRIX\fP. If \%\f3GLU_AUTO_LOAD_MATRIX\fP is not
  62. turned off, then any NURBS surface rendered is subdivided differently with
  63. the pick matrix than the way it was subdivided without the pick matrix.
  64. .bp
  65. .SH EXAMPLE
  66. When rendering a scene as follows:
  67. .sp
  68. .Ex
  69. glMatrixMode(GL_PROJECTION);
  70. glLoadIdentity();
  71. gluPerspective(...);
  72. glMatrixMode(GL_MODELVIEW);
  73. /* Draw the scene */
  74. .Ee
  75. .sp
  76. a portion of the viewport can be selected as a pick region like this:
  77. .sp
  78. .Ex
  79. glMatrixMode(GL_PROJECTION);
  80. glLoadIdentity();
  81. gluPickMatrix(x, y, width, height, viewport);
  82. gluPerspective(...);
  83. glMatrixMode(GL_MODELVIEW);
  84. /* Draw the scene */
  85. .Ee
  86. .SH SEE ALSO
  87. \f3glGet(3G)\fP,
  88. \f3glLoadIndentity(3G)\fP,
  89. \f3glMultMatrix(3G)\fP,
  90. \f3glRenderMode(3G)\fP,
  91. \%\f3gluPerspective(3G)\fP