stencilfunc.3gl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. '\" te
  2. '\"! tbl|eqn | mmdoc
  3. '\"macro stdmacro
  4. .ds Vn Version 1.2
  5. .ds Dt 24 September 1999
  6. .ds Re Release 1.2.1
  7. .ds Dp Jan 14 18:30
  8. .ds Dm 01 stencilfu
  9. .ds Xs 21383 6 stencilfunc.gl
  10. .TH GLSTENCILFUNC 3G
  11. .SH NAME
  12. .B "glStencilFunc
  13. \- set function and reference value for stencil testing
  14. .EQ
  15. delim $$
  16. .EN
  17. .SH C SPECIFICATION
  18. void \f3glStencilFunc\fP(
  19. GLenum \fIfunc\fP,
  20. .nf
  21. .ta \w'\f3void \fPglStencilFunc( 'u
  22. GLint \fIref\fP,
  23. GLuint \fImask\fP )
  24. .fi
  25. .SH PARAMETERS
  26. .TP \w'\f2func\fP\ \ 'u
  27. \f2func\fP
  28. Specifies the test function.
  29. Eight tokens are valid:
  30. \%\f3GL_NEVER\fP,
  31. \%\f3GL_LESS\fP,
  32. \%\f3GL_LEQUAL\fP,
  33. \%\f3GL_GREATER\fP,
  34. \%\f3GL_GEQUAL\fP,
  35. \%\f3GL_EQUAL\fP,
  36. \%\f3GL_NOTEQUAL\fP, and
  37. \%\f3GL_ALWAYS\fP. The initial value is \%\f3GL_ALWAYS\fP.
  38. .TP
  39. \f2ref\fP
  40. Specifies the reference value for the stencil test.
  41. \f2ref\fP is clamped to the range [0,$2 sup n - 1$],
  42. where $n$ is the number of bitplanes in the stencil buffer. The
  43. initial value is 0.
  44. .TP
  45. \f2mask\fP
  46. Specifies a mask that is ANDed with both the reference value
  47. and the stored stencil value when the test is done. The initial value
  48. is all 1's.
  49. .SH DESCRIPTION
  50. Stenciling,
  51. like depth-buffering,
  52. enables and disables drawing on a per-pixel basis.
  53. You draw into the stencil planes using GL drawing primitives,
  54. then render geometry and images,
  55. using the stencil planes to mask out portions of the screen.
  56. Stenciling is typically used in multipass rendering algorithms
  57. to achieve special effects,
  58. such as decals,
  59. outlining,
  60. and constructive solid geometry rendering.
  61. .P
  62. The stencil test conditionally eliminates a pixel based on the outcome
  63. of a comparison between the reference value
  64. and the value in the stencil buffer.
  65. To enable and disable the test, call \%\f3glEnable\fP and \%\f3glDisable\fP
  66. with argument \%\f3GL_STENCIL_TEST\fP.
  67. To specify actions based on the outcome of the stencil test, call
  68. \%\f3glStencilOp\fP.
  69. .P
  70. \f2func\fP is a symbolic constant that determines the stencil comparison function.
  71. It accepts one of eight values,
  72. shown in the following list.
  73. \f2ref\fP is an integer reference value that is used in the stencil comparison.
  74. It is clamped to the range [0,$2 sup n - 1$],
  75. where $n$ is the number of bitplanes in the stencil buffer.
  76. \f2mask\fP is bitwise ANDed with both the reference value
  77. and the stored stencil value,
  78. with the ANDed values participating in the comparison.
  79. .P
  80. If \f2stencil\fP represents the value stored in the corresponding
  81. stencil buffer location,
  82. the following list shows the effect of each comparison function
  83. that can be specified by \f2func\fP.
  84. Only if the comparison succeeds is the pixel passed through
  85. to the next stage in the rasterization process
  86. (see \%\f3glStencilOp\fP).
  87. All tests treat \f2stencil\fP values as unsigned integers in the range
  88. [0,$2 sup n - 1$],
  89. where $n$ is the number of bitplanes in the stencil buffer.
  90. .P
  91. The following values are accepted by \f2func\fP:
  92. .TP 18
  93. \%\f3GL_NEVER\fP
  94. Always fails.
  95. .TP
  96. \%\f3GL_LESS\fP
  97. Passes if ( \f2ref\fP & \f2mask\fP ) < ( \f2stencil\fP & \f2mask\fP ).
  98. .TP
  99. \%\f3GL_LEQUAL\fP
  100. Passes if ( \f2ref\fP & \f2mask\fP ) \(<= ( \f2stencil\fP & \f2mask\fP ).
  101. .TP
  102. \%\f3GL_GREATER\fP
  103. Passes if ( \f2ref\fP & \f2mask\fP ) > ( \f2stencil\fP & \f2mask\fP ).
  104. .TP
  105. \%\f3GL_GEQUAL\fP
  106. Passes if ( \f2ref\fP & \f2mask\fP ) \(>= ( \f2stencil\fP & \f2mask\fP ).
  107. .TP
  108. \%\f3GL_EQUAL\fP
  109. Passes if ( \f2ref\fP & \f2mask\fP ) = ( \f2stencil\fP & \f2mask\fP ).
  110. .TP
  111. \%\f3GL_NOTEQUAL\fP
  112. Passes if ( \f2ref\fP & \f2mask\fP ) \(!= ( \f2stencil\fP & \f2mask\fP ).
  113. .TP
  114. \%\f3GL_ALWAYS\fP
  115. Always passes.
  116. .SH NOTES
  117. Initially, the stencil test is disabled.
  118. If there is no stencil buffer,
  119. no stencil modification can occur and it is as if
  120. the stencil test always passes.
  121. .SH ERRORS
  122. \%\f3GL_INVALID_ENUM\fP is generated if \f2func\fP is not one of the eight
  123. accepted values.
  124. .P
  125. \%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glStencilFunc\fP
  126. is executed between the execution of \%\f3glBegin\fP
  127. and the corresponding execution of \%\f3glEnd\fP.
  128. .SH ASSOCIATED GETS
  129. \%\f3glGet\fP with argument \%\f3GL_STENCIL_FUNC\fP
  130. .br
  131. \%\f3glGet\fP with argument \%\f3GL_STENCIL_VALUE_MASK\fP
  132. .br
  133. \%\f3glGet\fP with argument \%\f3GL_STENCIL_REF\fP
  134. .br
  135. \%\f3glGet\fP with argument \%\f3GL_STENCIL_BITS\fP
  136. .br
  137. \%\f3glIsEnabled\fP with argument \%\f3GL_STENCIL_TEST\fP
  138. .SH SEE ALSO
  139. \%\f3glAlphaFunc(3G)\fP,
  140. \%\f3glBlendFunc(3G)\fP,
  141. \%\f3glDepthFunc(3G)\fP,
  142. \%\f3glEnable(3G)\fP,
  143. \%\f3glIsEnabled(3G)\fP,
  144. \%\f3glLogicOp(3G)\fP,
  145. \%\f3glStencilOp(3G)\fP