'\" t .\" Title: gl_ClipDistance .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 01/03/2018 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GL_CLIPDISTANCE" "3G" "01/03/2018" "[FIXME: source]" "[FIXME: manual]" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" gl_ClipDistance \- provides a forward\-compatible mechanism for vertex clipping .SH "DECLARATION" .PP \fIgl_ClipDistance\fR is a member of the \fIgl_PerVertex\fR named block: .sp .nf out gl_PerVertex { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[]; }; .fi .PP In fragment shaders, it is intrinsically declared as: in\ \&float\ \&gl_ClipDistance[]\ \&; .SH "DESCRIPTION" .PP The \fIgl_ClipDistance\fR variable provides a forward compatible mechanism for controlling user clipping\&. The element \fIgl_ClipDistance\fR[\fIi\fR] specifies a clip distance for each user clip plane \fIi\fR\&. A distance of 0\&.0 means that the vertex is on the plane, a positive distance means that the vertex is insider the clip plane, and a negative distance means that the point is outside the clip plane\&. The clip distances will be linearly interpolated across the primitive and the portion of the primitive with interpolated distances less than 0\&.0 will be clipped\&. .PP The \fIgl_ClipDistance\fR array is initially predeclared as unsized and must be sized by the shader either by redeclaring it with an explicit size, or by indexing it with only integral constant expressions\&. The array must be sized to include all clip planes that are enabled via the OpenGL API; if the size does not include all enabled planes, results are undefined\&. The size may be at most \fIgl_MaxClipDistances\fR\&. The number of varying components consumed by \fIgl_ClipDistance\fR will match the size of the array, no matter how many planes are enabled\&. The shader must also set all values in \fIgl_ClipDistance\fR that have been enabled via the OpenGL API, or results are undefined\&. Values written into \fIgl_ClipDistance\fR planes that are not enabled have no effect\&. .PP In the vertex, tessellation evaluation and geometry languages, a single global instance of the \fIgl_PerVertex\fR named block is available and its \fIgl_ClipDistance\fR member is an output that receives the clip distances for the current vertex\&. It may be written at any time during shader execution\&. The value written to \fIgl_ClipDistance\fR will be used by primitive assembly, clipping, culling and other fixed functionality operations, if present, that operate on primitives after vertex processing has occurred\&. .PP In the tessellation control language, the \fIgl_PerVertex\fR named block is used to construct an array, \fIgl_out[]\fR, whose \fIgl_ClipDistance\fR members hold clip distances for each of the control points, which become available as inputs to the subsequent tessellation evaluation shader\&. .PP The value of \fIgl_ClipDistance\fR (or the \fIgl_ClipDistance\fR member of the \fIgl_out[]\fR 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_ClipDistance\&. It is also undefined after the geometry processing stage if the geometry shader executable calls \fBEmitVertex\fR() without having written \fIgl_ClipDistance\fR since the last call to \fBEmitVertex\fR() (or hasn\*(Aqt written it at all)\&. .PP In the tessellation control, tessellation evaluation and geoemetry languages, the \fIgl_PerVertex\fR named block is used to construct an array, \fIgl_in[]\fR of per\-vertex or per\-control point inputs whose content represents the corresponding outputs written by the previous stage\&. Only elements of the \fIgl_ClipDistance\fR array that correspond to enabled clip planes have defined values\&. .SH "VERSION SUPPORT" .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ \fBOpenGL Shading Language Version\fR T} T{ \fBVariable Name\fR T}:T{ \fB1\&.10\fR T}:T{ \fB1\&.20\fR T}:T{ \fB1\&.30\fR T}:T{ \fB1\&.40\fR T}:T{ \fB1\&.50\fR T}:T{ \fB3\&.30\fR T}:T{ \fB4\&.00\fR T}:T{ \fB4\&.10\fR T}:T{ \fB4\&.20\fR T}:T{ \fB4\&.30\fR T}:T{ \fB4\&.40\fR T}:T{ \fB4\&.50\fR T} .T& l c c c c c c c c c c c c. T{ gl_ClipDistance T}:T{ \- T}:T{ \- T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} .TE .sp 1 .PP Versions 1\&.30 to 1\&.40 \- vertex shader only\&. .PP Versions 1\&.50 to 3\&.30 \- vertex and geometry shaders only\&. .SH "SEE ALSO" .PP \fBgl_CullDistance\fR(), \fBgl_PointSize\fR() .SH "COPYRIGHT" .PP Copyright \(co 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\&. \m[blue]\fBhttp://opencontent\&.org/openpub/\fR\m[]\&. .SH "COPYRIGHT" .br Copyright \(co 2011-2014 Khronos Group .br