gl_FrontFacing - OpenGL 4 Reference Pages - Khronos Group
文章推薦指數: 80 %
Available only in the fragment language, gl_FrontFacing is an input variable whose value is true if the fragment belongs to a front-facing primitive and ... Name gl_FrontFacing—indicateswhetheraprimitiveisfrontorbackfacing Declaration in bool gl_FrontFacing ; Description Availableonlyinthefragmentlanguage,gl_FrontFacingisaninputvariable whosevalueistrueifthefragmentbelongstoafront-facingprimitiveand falseotherwise.Thedeterminationofwhetheratriangleprimitiveisfront-facingismadeby examiningthesignoftheareaofthetriangle,includingapossiblereversalofthissign ascontrolledbyglFrontFace.Onewaytocomputethisareais: a=12 ∑ j=0 n-1 x w i y w i+1 - x w i+1 y w i where x w i and y w i are thexandywindowcoordinatesoftheithvertexofthen-vertexpolygon. Thesignofthiscomputationisnegatedwhenthevalueof GL_CLIP_ORIGIN(theclipvolumeorigin,set with glClipControl) isGL_UPPER_LEFT. VersionSupport OpenGLShadingLanguageVersion VariableName 1.10 1.20 1.30 1.40 1.50 3.30 4.00 4.10 4.20 4.30 4.40 4.50 gl_FrontFacing ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ SeeAlso gl_FragCoord, glClipControl Copyright Copyright©2011-2014KhronosGroup. Thismaterialmaybedistributedsubjecttothetermsandconditionssetforthin theOpenPublicationLicense,v1.0,8June1999. http://opencontent.org/openpub/.
延伸文章資訊
- 1OpenGL Programming Guide: The Official Guide to Learning ...
OpenGL Shading Language has a builtin Boolean variable gl_FrontFacing allowing you to do so. The ...
- 2gl_FrontFacing - OpenGL 4 Reference Pages - Khronos Group
Available only in the fragment language, gl_FrontFacing is an input variable whose value is true ...
- 3Is there a reliable alternative to gl_FrontFacing in a fragment ...
- 4在片段着色器中是否有可靠的gl_FrontFacing 替代方案? |
根据我过去的经验,对的支持 gl_FrontFacing 参差不齐。有时它只是失败,有时它会导致回退到软件渲染。所以我尝试使用 GL_VERTEX_PROGRAM_TWO_SIDE ...
- 5高级GLSL
gl_FrontFacing. 片段着色器另一个有意思的输入变量是 gl_FrontFacing 变量。在面剔除教程中,我们提到过OpenGL可以根据 ...