gl_FragCoord - contains the window-relative coordinates of ...
文章推薦指數: 80 %
By default, gl_FragCoord assumes a lower-left origin for window coordinates and assumes pixel centers are located at half-pixel centers. For example, the (x ... Providedby:opengl-4-man-doc_1.0~svn33624-1_all NAME gl_FragCoord-containsthewindow-relativecoordinatesofthecurrentfragment DECLARATION invec4gl_FragCoord;.SH"DESCRIPTION" Availableonlyinthefragmentlanguage,gl_FragCoordisaninputvariablethatcontains thewindowrelativecoordinate(x,y,z,1/w)valuesforthefragment.Ifmulti-sampling, thisvaluecanbeforanylocationwithinthepixel,oroneofthefragmentsamples.This valueistheresultoffixedfunctionalitythatinterpolatesprimitivesaftervertex processingtogeneratefragments.Thezcomponentisthedepthvaluethatwouldbeused forthefragment'sdepthifnoshadercontainedanywritestogl_FragDepth(). gl_FragCoordmayberedeclaredwiththeadditionallayoutqualifieridentifiers origin_upper_leftorpixel_center_integer.Bydefault,gl_FragCoordassumesalower-left originforwindowcoordinatesandassumespixelcentersarelocatedathalf-pixelcenters. Forexample,the(x,y)location(0.5,0.5)isreturnedforthelower-left-mostpixelina window.Theoriginofgl_FragCoordmaybechangedbyredeclaringgl_FragCoordwiththe origin_upper_leftidentifier.Thevaluesreturnedcanalsobeshiftedbyhalfapixelin bothxandybypixel_center_integersoitappearsthepixelsarecenteredatwholenumber pixeloffsets.Thismovesthe(x,y)valuereturnedbygl_FragCoordof(0.5,0.5)by defaultto(0.0,0.0)withpixel_center_integer. Ifgl_FragCoordisredeclaredinanyfragmentshaderinaprogram,itmustberedeclared inallfragmentshadersinthatprogramthathavestaticuseofgl_FragCoord.Redeclaring gl_FragCoordwithanyacceptedqualifieraffectsonlygl_FragCoord.xandgl_FragCoord.y. Ithasnoaffectonrasterization,transformationoranyotherpartoftheOpenGLpipline orlanguagefeatures. VERSIONSUPPORT ┌─────────────┬───────────────────────────────────────────────────────────────────────────────────┐ ││OpenGLShadingLanguageVersion│ ├─────────────┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┤ │Variable│1.10│1.20│1.30│1.40│1.50│3.30│4.00│4.10│4.20│4.30│4.40│4.50│ │Name│││││││││││││ ├─────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤ │gl_FragCoord│✔│✔│✔│✔│✔│✔│✔│✔│✔│✔│✔│✔│ └─────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘ SEEALSO gl_FragCoord() COPYRIGHT Copyright©2011-2014KhronosGroup.Thismaterialmaybedistributedsubjecttotheterms andconditionssetforthintheOpenPublicationLicense,v1.0,8June1999. http://opencontent.org/openpub/. COPYRIGHT Copyright©2011-2014KhronosGroup [FIXME:source]01/03/2018GL_FRAGCOORD(3G)
延伸文章資訊
- 1Fragment Shader Introduction - FreeDesktop.Org
will build on these examples. 1.1 Drawing Circles Using gl_FragCoord. It would seem that a fragme...
- 2GLSL-to-HLSL reference - UWP applications | Microsoft Docs
- 3高级GLSL
片段着色器的变量. 在片段着色器中也有一些有趣的变量。GLSL给我们提供了两个有意思的输入变量,它们是 gl_FragCoord ...
- 4How to get coordinate of fragment shaders? gl_FragCoord not ...
See the (WebGL) example, where I applied the suggestions to the the fragment shader of the questi...
- 5Fragment shader for a very simple Android shader example
precision highp float;. void main(). {. // gl_FragCoord contains the window relative coordinate f...