Gambas文档
编译和安装
错误消息
代码片段
待办事项
废弃的组件
教程
开发环境文档
开发者文档
名词解释
如何操作
说明
维基手册
维基搜索
维基许可协议
文档
应用程序仓库
语言概览
语言索引
主题
组件
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.qt
gb.gui.qt.ext
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.io
gb.inotify
gb.logging
gb.map
gb.media
gb.media.form
gb.mime
gb.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.opengl
Gl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.sdl
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
最近的修改

Gl.StencilFunc (gb.opengl)

Static Sub StencilFunc ( Function As Integer, Reference As Integer, Mask As Integer )

Set front and back function and reference value for stencil testing.

Parameters

func

Specifies the test function. Eight symbolic constants are valid: Gl.NEVER, Gl.LESS, Gl.LEQUAL, Gl.GREATER, Gl.GEQUAL, Gl.EQUAL, Gl.NOTEQUAL, and Gl.ALWAYS. The initial value is Gl.ALWAYS.
ref

Specifies the reference value for the stencil test. ref is clamped to the range 0 2 n - 1 , where n is the number of bitplanes in the stencil buffer. The initial value is 0.
mask

Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.

Description

Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. Stencil planes are first drawn into using GL drawing primitives, then geometry and images are rendered using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.

The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call Gl.Enable and Gl.Disable with argument Gl.STENCIL_TEST. To specify actions based on the outcome of the stencil test, call Gl.StencilOp or Gl.StencilOpSeparate.

There can be two separate sets of func, ref, and mask parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. Gl.StencilFunc sets both front and back stencil state to the same values. Use Gl.StencilFuncSeparate to set front and back stencil state to different values.

func is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. ref is an integer reference value that is used in the stencil comparison. It is clamped to the range 0 2 n - 1 , where n is the number of bitplanes in the stencil buffer. mask is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison.

If stencil represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by func. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see Gl.StencilOp). All tests treat stencil values as unsigned integers in the range 0 2 n - 1 , where n is the number of bitplanes in the stencil buffer.

The following values are accepted by func:
Gl.NEVER

Always fails.
Gl.LESS

Passes if ( ref & mask ) < ( stencil & mask ).
Gl.LEQUAL

Passes if ( ref & mask ) <= ( stencil & mask ).
Gl.GREATER

Passes if ( ref & mask ) > ( stencil & mask ).
Gl.GEQUAL

Passes if ( ref & mask ) >= ( stencil & mask ).
Gl.EQUAL

Passes if ( ref & mask ) = ( stencil & mask ).
Gl.NOTEQUAL

Passes if ( ref & mask ) != ( stencil & mask ).
Gl.ALWAYS

Always passes.

Notes

Initially, the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil test always passes.

Gl.StencilFunc is the same as calling Gl.StencilFuncSeparate with face set to Gl.FRONT_AND_BACK.

Errors

Gl.INVALID_ENUM is generated if func is not one of the eight accepted values.

Associated Gets

Gl.Get with argument Gl.STENCIL_FUNC, Gl.STENCIL_VALUE_MASK, Gl.STENCIL_REF, Gl.STENCIL_BACK_FUNC, Gl.STENCIL_BACK_VALUE_MASK, Gl.STENCIL_BACK_REF, or Gl.STENCIL_BITS

Gl.IsEnabled with argument Gl.STENCIL_TEST

See also

Gl.LogicOp, Gl.StencilFuncSeparate, Gl.StencilMaskSeparate, Gl.StencilOp, Gl.StencilOpSeparate

See original documentation on OpenGL website