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=
"glGetUniform">
6 <refentrytitle>glGetUniform
</refentrytitle>
7 <manvolnum>3G
</manvolnum>
10 <refdescriptor>glGetUniform
</refdescriptor>
11 <refname>glGetUniformfv
</refname>
12 <refname>glGetUniformiv
</refname>
13 <refpurpose>Returns the value of a uniform variable
</refpurpose>
15 <refsynopsisdiv><title>C Specification
</title>
18 <funcdef>void
<function>glGetUniformfv
</function></funcdef>
19 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
20 <paramdef>GLint
<parameter>location
</parameter></paramdef>
21 <paramdef>GLfloat *
<parameter>params
</parameter></paramdef>
24 <funcdef>void
<function>glGetUniformiv
</function></funcdef>
25 <paramdef>GLuint
<parameter>program
</parameter></paramdef>
26 <paramdef>GLint
<parameter>location
</parameter></paramdef>
27 <paramdef>GLint *
<parameter>params
</parameter></paramdef>
31 <refsect1 id=
"parameters"><title>Parameters
</title>
34 <term><parameter>program
</parameter></term>
36 <para>Specifies the program object to be
41 <term><parameter>location
</parameter></term>
43 <para>Specifies the location of the uniform variable
48 <term><parameter>params
</parameter></term>
50 <para>Returns the value of the specified uniform
56 <refsect1 id=
"description"><title>Description
</title>
57 <para><function>glGetUniform
</function> returns in
58 <parameter>params
</parameter> the value(s) of the specified
59 uniform variable. The type of the uniform variable specified by
60 <parameter>location
</parameter> determines the number of values
61 returned. If the uniform variable is defined in the shader as a
62 boolean, int, or float, a single value will be returned. If it
63 is defined as a vec2, ivec2, or bvec2, two values will be
64 returned. If it is defined as a vec3, ivec3, or bvec3, three
65 values will be returned, and so on. To query values stored in
66 uniform variables declared as arrays, call
67 <function>glGetUniform
</function> for each element of the array.
68 To query values stored in uniform variables declared as
69 structures, call
<function>glGetUniform
</function> for each
70 field in the structure. The values for uniform variables
71 declared as a matrix will be returned in column major
74 <para>The locations assigned to uniform variables are not known
75 until the program object is linked. After linking has occurred,
77 <citerefentry><refentrytitle>glGetUniformLocation
</refentrytitle></citerefentry>
78 can be used to obtain the location of a uniform variable. This
79 location value can then be passed to
80 <function>glGetUniform
</function> in order to query the current
81 value of the uniform variable. After a program object has been
82 linked successfully, the index values for uniform variables
83 remain fixed until the next link command occurs. The uniform
84 variable values can only be queried after a link if the link was
87 <refsect1 id=
"notes"><title>Notes
</title>
88 <para><function>glGetUniform
</function> is available only if the
89 GL version is
2.0 or greater.
</para>
91 <para>If an error is generated, no change is made to the
92 contents of
<parameter>params
</parameter>.
</para>
94 <refsect1 id=
"errors"><title>Errors
</title>
95 <para><constant>GL_INVALID_VALUE
</constant> is generated if
96 <parameter>program
</parameter> is not a value generated by
99 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
100 <parameter>program
</parameter> is not a program object.
</para>
102 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
103 <parameter>program
</parameter> has not been successfully
106 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
107 <parameter>location
</parameter> does not correspond to a valid
108 uniform variable location for the specified program object.
</para>
110 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
111 <function>glGetUniform
</function> is executed between the
113 <citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>
114 and the corresponding execution of
115 <citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
</para>
117 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
118 <para><citerefentry><refentrytitle>glGetActiveUniform
</refentrytitle></citerefentry>
119 with arguments
<parameter>program
</parameter> and the index of an active
120 uniform variable
</para>
122 <para><citerefentry><refentrytitle>glGetProgram
</refentrytitle></citerefentry>
123 with arguments
<parameter>program
</parameter> and
124 <constant>GL_ACTIVE_UNIFORMS
</constant> or
125 <constant>GL_ACTIVE_UNIFORM_MAX_LENGTH
</constant></para>
127 <para><citerefentry><refentrytitle>glGetUniformLocation
</refentrytitle></citerefentry>
128 with arguments
<parameter>program
</parameter> and the name of a
129 uniform variable
</para>
130 <para><citerefentry><refentrytitle>glIsProgram
</refentrytitle></citerefentry></para>
132 <refsect1 id=
"seealso"><title>See Also
</title>
133 <para><citerefentry><refentrytitle>glCreateProgram
</refentrytitle></citerefentry>,
134 <citerefentry><refentrytitle>glLinkProgram
</refentrytitle></citerefentry>,
135 <citerefentry><refentrytitle>glUniform
</refentrytitle></citerefentry></para>
137 <refsect1 id=
"Copyright"><title>Copyright
</title>
139 Copyright
<trademark class=
"copyright"></trademark> 2003-
2005 3Dlabs Inc. Ltd.
140 This material may be distributed subject to the terms and conditions set forth in
141 the Open Publication License, v
1.0,
8 June
1999.
142 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.