include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / manglsl / gl_ClipDistance.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="gl_ClipDistance">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2011</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>gl_ClipDistance</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>gl_ClipDistance</refname>
17 <refpurpose>provides a forward-compatible mechanism for vertex clipping</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>Declaration</title>
20 <para>
21 <function>gl_ClipDistance</function> is a member of the <function>gl_PerVertex</function>
22 named block:
23 </para>
24 <funcsynopsis>
25 <programlisting><![CDATA[ out gl_PerVertex {
26 vec4 gl_Position;
27 float gl_PointSize;
28 float gl_ClipDistance[];
29 };]]></programlisting>
30 </funcsynopsis>
31 <para>
32 In the fragment language, it is intrinsically declared as:
33 </para>
34 <funcsynopsis>
35 <function>in float gl_ClipDistance[];</function>
36 </funcsynopsis>
37 </refsynopsisdiv>
38 <refsect1 id="description"><title>Description</title>
39 <para>
40 The <function>gl_ClipDistance</function> variable provides a forward compatible
41 mechanism for controlling user clipping. The element <function>gl_ClipDistance[<emphasis>i</emphasis>]</function>
42 specifies a clip distance for each user clip plane <emphasis>i</emphasis>. A distance of 0.0 means that
43 the vertex is on the plane, a positive distance means that the vertex is insider the clip plane, and a negative
44 distance means that the point is outside the clip plane. The clip distances will be linearly interpolated across
45 the primitive and the portion of the primitive with interpolated distances less than 0.0 will be clipped.
46 </para>
47 <para>
48 The <function>gl_ClipDistance</function> array is initially predeclared as unsized and must be
49 sized by the shader either by redeclaring it with an explicit size, or by indexing it
50 with only integral constant expressions. The array must be sized to include all
51 clip planes that are enabled via the OpenGL API; if the size does not include all enabled planes,
52 results are undefined. The size may be at most <function>gl_MaxClipDistances</function>. The number
53 of variing components consumed by <function>gl_ClipDistance</function> will match the size of the
54 array, no matter how many planes are enabled. The shader must also set all values in <function>gl_ClipDistance</function>
55 that have been enabled via the OpenGL API, or results are undefined. Values written into
56 <function>gl_ClipDistance</function> planes that are not enabled have no effect.
57 </para>
58 <para>
59 In the vertex, tessellation evaluation and geoemtry languages, a single
60 global instance of the <function>gl_PerVertex</function> named block is available and
61 its <function>gl_ClipDistance</function> member is an output that receives the
62 clip distances for the current vertex. It may be written at any time during shader execution.
63 The value written to <function>gl_ClipDistance</function> will be used by primitive assembly,
64 clipping, culling and other fixed functionality operations, if present, that operate on
65 primitives after vertex processing has occurred.
66 </para>
67 <para>
68 In the tessellation control language, the <function>gl_PerVertex</function> named block
69 is used to construct an array, <function>gl_out[]</function>, whose <function>gl_ClipDistance</function>
70 members hold clip distances for each of the control points, which become available as inputs to the subsequent
71 tessellation evaluation shader.
72 </para>
73 <para>
74 The value of <function>gl_ClipDistance</function> (or the <function>gl_ClipDistance</function> member of the <function>gl_out[]</function>
75 array, in the case of the tessellation control shader)
76 is undefined after the vertex, tessellation control, and tessellation evaluation
77 shading stages if the corresponding shader executable does
78 not write to gl_ClipDistance. It is also undefined after the geometry processing stage if the geometry shader executable calls
79 <citerefentry><refentrytitle>EmitVertex</refentrytitle></citerefentry> without having
80 written <function>gl_ClipDistance</function> since the last call to <citerefentry><refentrytitle>EmitVertex</refentrytitle></citerefentry>
81 (or hasn't written it at all).
82 </para>
83 <para>
84 In the tessellation control, tessellation evaluation and geoemetry languages,
85 the <function>gl_PerVertex</function> named block is used to construct an array, <function>gl_in[]</function>
86 of per-vertex or per-control point inputs whose content represents the corresponding
87 outputs written by the previous stage. Only elements of the <function>gl_ClipDistance</function>
88 array that correspond to enabled clip planes have defined values.
89 </para>
90 </refsect1>
91 <refsect1 id="versions"><title>Version Support</title>
92 <informaltable frame="topbot">
93 #VARTABLECOLS#
94 <thead>
95 #VARTABLEHEADER#
96 <row>
97 <entry>gl_ClipDistance</entry>#newin13#
98 </row>
99 </thead>
100 </tgroup>
101 </informaltable>
102 <para>Versions 1.30 to 1.40 - vertex shader only.</para>
103 <para>Versions 1.50 to 3.30 - vertex and geometry shaders only.</para>
104 </refsect1>
105 <refsect1 id="seealso"><title>See Also</title>
106 <para>
107 <citerefentry><refentrytitle>gl_PointSize</refentrytitle></citerefentry>
108 </para>
109 </refsect1>
110 <refsect1 id="Copyright"><title>Copyright</title>
111 <para>
112 Copyright <trademark class="copyright"></trademark> 2011 Khronos Group.
113 This material may be distributed subject to the terms and conditions set forth in
114 the Open Publication License, v 1.0, 8 June 1999.
115 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
116 </para>
117 </refsect1>
118 </refentry>