From OpenGL Reference
Jump to navigation Jump to search

Contains the position of the current vertex.



In the vertex, tessellation evaluation and geometry languages, a single global instance of thegl_PerVertexnamed block is available and itsgl_Positionmember is an output that receives the homogeneous vertex position. It may be written at any time during shader execution. The value written togl_Positionwill be used by primitive assembly, clipping, culling and other fixed functionality operations, if present, that operate on primitives after vertex processing has occurred.

In the tessellation control language, thegl_PerVertexnamed block is used to construct an array,gl_out[], whosegl_Positionmembers hold the homogeneous control point position, which become available as inputs to the subsequent tessellation evaluation shader.

The value ofgl_Position(or thegl_Positionmember of thegl_out[]array, in the case of the tessellation control shader) is undefined after the vertex, tessellation control, and tessellation evaluation shading stages if the corresponding shader executable does not write to gl_Position. It is also undefined after the geometry processing stage if the geometry shader executable calls EmitVertex without having writtengl_Positionsince the last call to EmitVertex (or hasn't written it at all).

In the tessellation control, tessellation evaluation and geometry languages, thegl_PerVertexnamed block is used to construct an array,gl_in[]of per-vertex or per-control point inputs whose content represents the corresponding outputs written by the previous stage.

Version Support[edit]

gl_Position 1.1+

Versions 1.10 to 1.40 - vertex shader only.

Versions 1.50 to 3.30 - vertex and geometry shaders only.

See Also[edit]

 gl_PointSize , gl_ClipDistance 


Copyright© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999.