OpenGL 1.1 Reference: glStencilFunc - Talisman
文章推薦指數: 80 %
glStencilFunc: set function and reference value for stencil testing. C Specification | Parameters | Description | Notes | Errors | Associated Gets | See Also. [ ... glStencilFunc glStencilFunc:setfunctionandreferencevalueforstenciltesting. CSpecification| Parameters| Description| Notes| Errors| AssociatedGets| SeeAlso CSpecification voidglStencilFunc( GLenum func, GLint ref, GLuint mask) Parameters func Specifiesthetestfunction.Eighttokensarevalid: GL_NEVER,GL_LESS, GL_LEQUAL,GL_GREATER, GL_GEQUAL,GL_EQUAL, GL_NOTEQUAL,andGL_ALWAYS.Theinitial valueisGL_ALWAYS. ref Specifiesthereferencevalueforthestenciltest.ref isclampedtotherange[0,2n1],wherenisthe numberofbitplanesinthestencilbuffer.Theinitialvalueis0. mask SpecifiesamaskthatisANDedwithboththereferencevalueandthe storedstencilvaluewhenthetestisdone.Theinitialvalueisall1s. Description Stenciling,likedepth-buffering,enablesanddisablesdrawingonaper-pixel basis.YoudrawintothestencilplanesusingGLdrawingprimitives,then rendergeometryandimages,usingthestencilplanestomaskoutportionsof thescreen.Stencilingistypicallyusedinmultipassrenderingalgorithmsto achievespecialeffects,suchasdecals,outlining,andconstructivesolid geometryrendering. Thestenciltestconditionallyeliminatesapixelbasedontheoutcomeofa comparisonbetweenthereferencevalueandthevalueinthestencilbuffer. Toenableanddisablethetest,callglEnableandglDisablewithargument GL_STENCIL_TEST.Tospecifyactionsbasedontheoutcomeof thestenciltest,callglStencilOp. funcisasymbolicconstantthatdeterminesthestencil comparisonfunction.Itacceptsoneofeightvalues,showninthefollowing list.refisanintegerreferencevaluethatisusedinthe stencilcomparison.Itisclampedtotherange[0,2n 1],wherenisthe numberofbitplanesinthestencilbuffer.maskisbitwise andedwithboththereferencevalueandthestoredstencilvalue,with theandedvaluesparticipatinginthecomparison. Ifstencilrepresentsthevaluestoredinthecorresponding stencilbufferlocation,thefollowinglistshowstheeffectofeach comparisonfunctionthatcanbespecifiedbyfunc.Onlyif thecomparisonsucceedsisthepixelpassedthroughtothenextstageinthe rasterizationprocess(seeglStencilOp).Allteststreat stencilvaluesasunsignedintegersintherange[0, 2n1],where nisthenumberofbitplanesinthestencilbuffer. Thefollowingvaluesareacceptedbyfunc: GL_NEVER Alwaysfails. GL_LESS Passesif(ref&mask)< (stencil&mask). GL_LEQUAL Passesif(ref&mask) (stencil&mask). GL_GREATER Passesif(ref&mask)> (stencil&mask). GL_GEQUAL Passesif(ref&mask) (stencil&mask). GL_EQUAL Passesif(ref&mask)= (stencil&mask). GL_NOTEQUAL Passesif(ref&mask) (stencil&mask). GL_ALWAYS Alwayspasses. Notes Initially,thestenciltestisdisabled.Ifthereisnostencilbuffer,no stencilmodificationcanoccuranditisasifthestenciltestalwayspasses. Errors GL_INVALID_ENUMisgeneratediffuncis notoneoftheeightacceptedvalues. GL_INVALID_OPERATIONisgeneratedifglStencilFuncisexecutedbetween theexecutionofglBeginandthe correspondingexecutionofglEnd. AssociatedGets glGetwithargument GL_STENCIL_FUNC glGetwithargument GL_STENCIL_VALUE_MASK glGetwithargument GL_STENCIL_REF glGetwithargument GL_STENCIL_BITS glIsEnabledwithargument GL_STENCIL_TEST SeeAlso glAlphaFunc, glBlendFunc, glDepthFunc, glEnable, glIsEnabled, glLogicOp, glStencilOp
延伸文章資訊
- 1glStencilFunc 函式(Gl) - Win32 apps | Microsoft Docs
GlStencilFunc 函數會設定樣板測試的函數和參考值。 ... void WINAPI glStencilFunc( GLenum func, GLint ref, GLuint mas...
- 2glStencilFunc_百度百科
glStencilFunc是GLenum func,GLint ref, GLuint mask的简称。
- 3OpenGL关于glStencilFuncSeparate()和glStencilFunc()函数的 ...
glStencilFunc()函数是OpenGL提供的对模板缓冲区进行控制的命令,这是OpenGL2.0之前使用的函数,其函数原型为void glStencilFunc(GLenum func,...
- 4C++ (Cpp) glStencilFunc Examples - HotExamples
C++ (Cpp) glStencilFunc - 30 examples found. These are the top rated real world C++ (Cpp) example...
- 5模板测试
但是 glStencilFunc 只描述了OpenGL对模板缓冲做什么,而不是描述我们如何更新缓冲。这就需要 glStencilOp 登场了。 void glStencilOp(GLenum s...