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=
"glBindFragDataLocation">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>glBindFragDataLocation
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glBindFragDataLocation
</refname>
17 <refpurpose>bind a user-defined varying out variable to a fragment shader color number
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glBindFragDataLocation
</function></funcdef>
23 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
24 <paramdef>GLuint
<parameter>colorNumber
</parameter></paramdef>
25 <paramdef>const char *
<parameter>name
</parameter></paramdef>
29 <refsect1 id=
"parameters"><title>Parameters
</title>
32 <term><parameter>program
</parameter></term>
35 The name of the program containing varying out variable whose binding to modify
40 <term><parameter>colorNumber
</parameter></term>
43 The color number to bind the user-defined varying out variable to
48 <term><parameter>name
</parameter></term>
51 The name of the user-defined varying out variable whose binding to modify
57 <refsect1 id=
"description"><title>Description
</title>
59 <function>glBindFragDataLocation
</function> explicitly specifies the binding of the user-defined varying out variable
60 <parameter>name
</parameter> to fragment shader color number
<parameter>colorNumber
</parameter> for program
61 <parameter>program
</parameter>. If
<parameter>name
</parameter> was bound previously, its assigned binding is replaced
62 with
<parameter>colorNumber
</parameter>.
<parameter>name
</parameter> must be a null-terminated string.
<parameter>colorNumber
</parameter>
63 must be less than
<constant>GL_MAX_DRAW_BUFFERS
</constant>.
66 The bindings specified by
<function>glBindFragDataLocation
</function> have no effect until
<parameter>program
</parameter>
67 is next linked. Bindings may be specified at any time after
<parameter>program
</parameter> has been created. Specifically,
68 they may be specified before shader objects are attached to the program. Therefore, any name may be specified in
<parameter>name
</parameter>,
69 including a name that is never used as a varying out variable in any fragment shader object. Names beginning with
<constant>gl_
</constant> are
73 In addition to the errors generated by
<function>glBindFragDataLocation
</function>, the
74 program
<parameter>program
</parameter> will fail to link if:
78 The number of active outputs is greater than the value
<constant>GL_MAX_DRAW_BUFFERS
</constant>.
83 More than one varying out variable is bound to the same color number.
89 <refsect1 id=
"notes"><title>Notes
</title>
91 Varying out varyings may have indexed locations assigned explicitly in the shader text using a
<code>location
</code>
92 layout qualifier. If a shader statically assigns a location to a varying out variable in the shader text,
93 that location is used and any location assigned with
<function>glBindFragDataLocation
</function> is ignored.
96 <refsect1 id=
"errors"><title>Errors
</title>
98 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>colorNumber
</parameter> is greater than or equal to
<constant>GL_MAX_DRAW_BUFFERS
</constant>.
101 <constant>GL_INVALID_OPERATION
</constant> is generated if
<parameter>name
</parameter> starts with the reserved
<constant>gl_
</constant> prefix.
104 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>program
</function> is not the name of a program object.
107 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
109 <citerefentry><refentrytitle>glGetFragDataLocation
</refentrytitle></citerefentry> with a valid program object
110 and the the name of a user-defined varying out variable
113 <refsect1 id=
"seealso"><title>See Also
</title>
115 <citerefentry><refentrytitle>glCreateProgram
</refentrytitle></citerefentry>,
116 <citerefentry><refentrytitle>glGetFragDataLocation
</refentrytitle></citerefentry>
119 <refsect1 id=
"Copyright"><title>Copyright
</title>
121 Copyright
<trademark class=
"copyright"></trademark> 2010 Khronos Group.
122 This material may be distributed subject to the terms and conditions set forth in
123 the Open Publication License, v
1.0,
8 June
1999.
124 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.