gl_Position - OpenGL 4 Reference Pages - Khronos Group
文章推薦指數: 80 %
The value of gl_Position (or the gl_Position member of the gl_out[] array, in the case of the tessellation control shader) is undefined after the vertex, ... Name gl_Position—containsthepositionofthecurrentvertex Declaration gl_Positionisamemberofthe gl_PerVertexnamedblock: outgl_PerVertex{ vec4gl_Position; floatgl_PointSize; floatgl_ClipDistance[]; }; Description Inthevertex,tessellationevaluationandgeometrylanguages,asingle globalinstanceofthegl_PerVertexnamedblockisavailableand itsgl_Positionmemberisanoutputthatreceivesthe homogeneousvertexposition.Itmaybewrittenatanytimeduringshaderexecution. Thevaluewrittentogl_Positionwillbeusedbyprimitiveassembly, clipping,cullingandotherfixedfunctionalityoperations,ifpresent,thatoperateon primitivesaftervertexprocessinghasoccurred. Inthetessellationcontrollanguage,thegl_PerVertexnamedblock isusedtoconstructanarray,gl_out[],whosegl_Position membersholdthehomogeneouscontrolpointposition,whichbecomeavailableasinputstothesubsequent tessellationevaluationshader. Thevalueofgl_Position(orthegl_Positionmemberofthegl_out[] array,inthecaseofthetessellationcontrolshader) isundefinedafterthevertex,tessellationcontrol,andtessellationevaluation shadingstagesifthecorrespondingshaderexecutabledoes notwritetogl_Position.Itisalsoundefinedafterthegeometryprocessingstageifthegeometryshaderexecutablecalls EmitVertexwithouthaving writtengl_PositionsincethelastcalltoEmitVertex (orhasn'twrittenitatall). Inthetessellationcontrol,tessellationevaluationandgeometrylanguages, thegl_PerVertexnamedblockisusedtoconstructanarray,gl_in[] ofper-vertexorper-controlpointinputswhosecontentrepresentsthecorresponding outputswrittenbythepreviousstage. VersionSupport OpenGLShadingLanguageVersion FunctionName 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_Position ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ Versions1.10to1.40-vertexshaderonly. Versions1.50to3.30-vertexandgeometryshadersonly. SeeAlso gl_PointSize,gl_ClipDistance Copyright Copyright©2011-2014KhronosGroup. Thismaterialmaybedistributedsubjecttothetermsandconditionssetforthin theOpenPublicationLicense,v1.0,8June1999. http://opencontent.org/openpub/.
延伸文章資訊
- 1認識著色器
getElementById('glCanvas')); installProgram(gl, shaderSourceById('vertex-shader'), shaderSourceBy...
- 2GLSL - Passing coordinates to fragment shader? - Stack ...
gl_Position is the clip-space position of a particular vertex. gl_FragCoord.xyz contains the wind...
- 3一起幫忙解決難題,拯救IT 人的一天
當特別談到Vertex Shader 的時候,每個輸入輛每個輸入的變數也較做頂點屬性(Vertex ... out vec3 vertexColor; // to Fragment Shader...
- 4高级GLSL
其中两个我们已经打过交道了: gl_Position 和 gl_FragCoord ,前一个是顶点着色器的 ... 好几次了,因为 gl_FragCoord 向量的z元素和特定的fragment...
- 5evn1
The vertex shader sets up the correct gl_Position, and the fragment shader is where we will intro...