Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glUniform</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glUniform"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glUniform — Specify the value of a uniform variable for the current program object</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform1f</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v0</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform2f</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v1</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform3f</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform4f</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v2</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">v3</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform1i</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v0</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform2i</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v1</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform3i</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform4i</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v0</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v2</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">v3</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform variable | |
4 | to be modified.</p></dd><dt><span class="term"> | |
5 | <em class="parameter"><code>v0</code></em>, | |
6 | <em class="parameter"><code>v1</code></em>, | |
7 | <em class="parameter"><code>v2</code></em>, | |
8 | <em class="parameter"><code>v3</code></em> | |
9 | </span></dt><dd><p>Specifies the new values to be used for the | |
10 | specified uniform variable.</p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform1fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform2fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform3fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform4fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform1iv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform2iv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform3iv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glUniform4iv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>const GLint * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform value to | |
11 | be modified.</p></dd><dt><span class="term"><em class="parameter"><code>count</code></em></span></dt><dd><p>Specifies the number of elements that are to | |
12 | be modified. This should be 1 if the targeted | |
13 | uniform variable is not an array, and 1 or more if it is | |
14 | an array.</p></dd><dt><span class="term"><em class="parameter"><code>value</code></em></span></dt><dd><p>Specifies a pointer to an array of | |
15 | <em class="parameter"><code>count</code></em> values that will be | |
16 | used to update the specified uniform | |
17 | variable.</p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix2fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix3fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix4fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix2x3fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix3x2fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix2x4fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix4x2fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix3x4fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glUniformMatrix4x3fv</b>(</code></td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">count</var>, </td></tr><tr><td> </td><td>GLboolean </td><td><var class="pdparam">transpose</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">value</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters3"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform value to | |
18 | be modified.</p></dd><dt><span class="term"><em class="parameter"><code>count</code></em></span></dt><dd><p>Specifies the number of matrices that are to | |
19 | be modified. This should be 1 if the targeted | |
20 | uniform variable is not an array of matrices, and 1 or more if it is | |
21 | an array of matrices.</p></dd><dt><span class="term"><em class="parameter"><code>transpose</code></em></span></dt><dd><p>Specifies whether to transpose the matrix as | |
22 | the values are loaded into the uniform | |
23 | variable.</p></dd><dt><span class="term"><em class="parameter"><code>value</code></em></span></dt><dd><p>Specifies a pointer to an array of | |
24 | <em class="parameter"><code>count</code></em> values that will be | |
25 | used to update the specified uniform | |
26 | variable.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p><code class="function">glUniform</code> modifies the value of a | |
27 | uniform variable or a uniform variable array. The location of | |
28 | the uniform variable to be modified is specified by | |
29 | <em class="parameter"><code>location</code></em>, which should be a value | |
30 | returned by | |
31 | <a class="citerefentry" href="glGetUniformLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniformLocation</span></span></a>. | |
32 | <code class="function">glUniform</code> operates on the program object | |
33 | that was made part of current state by calling | |
34 | <a class="citerefentry" href="glUseProgram.xml"><span class="citerefentry"><span class="refentrytitle">glUseProgram</span></span></a>.</p><p>The commands <code class="function">glUniform{1|2|3|4}{f|i}</code> | |
35 | are used to change the value of the uniform variable specified | |
36 | by <em class="parameter"><code>location</code></em> using the values passed as | |
37 | arguments. The number specified in the command should match the | |
38 | number of components in the data type of the specified uniform | |
39 | variable (e.g., <code class="function">1</code> for float, int, bool; | |
40 | <code class="function">2</code> for vec2, ivec2, bvec2, etc.). The suffix | |
41 | <code class="function">f</code> indicates that floating-point values are | |
42 | being passed; the suffix <code class="function">i</code> indicates that | |
43 | integer values are being passed, and this type should also match | |
44 | the data type of the specified uniform variable. The | |
45 | <code class="function">i</code> variants of this function should be used | |
46 | to provide values for uniform variables defined as int, ivec2, | |
47 | ivec3, ivec4, or arrays of these. The <code class="function">f</code> | |
48 | variants should be used to provide values for uniform variables | |
49 | of type float, vec2, vec3, vec4, or arrays of these. Either the | |
50 | <code class="function">i</code> or the <code class="function">f</code> variants | |
51 | may be used to provide values for uniform variables of type | |
52 | bool, bvec2, bvec3, bvec4, or arrays of these. The uniform | |
53 | variable will be set to false if the input value is 0 or 0.0f, | |
54 | and it will be set to true otherwise.</p><p>All active uniform variables defined in a program object | |
55 | are initialized to 0 when the program object is linked | |
56 | successfully. They retain the values assigned to them by a call | |
57 | to <code class="function">glUniform </code> until the next successful | |
58 | link operation occurs on the program object, when they are once | |
59 | again initialized to 0.</p><p>The commands <code class="function">glUniform{1|2|3|4}{f|i}v</code> | |
60 | can be used to modify a single uniform variable or a uniform | |
61 | variable array. These commands pass a count and a pointer to the | |
62 | values to be loaded into a uniform variable or a uniform | |
63 | variable array. A count of 1 should be used if modifying the | |
64 | value of a single uniform variable, and a count of 1 or greater | |
65 | can be used to modify an entire array or part of an array. When | |
66 | loading <span class="emphasis"><em>n</em></span> elements starting at an arbitrary | |
67 | position <span class="emphasis"><em>m</em></span> in a uniform variable array, | |
68 | elements <span class="emphasis"><em>m</em></span> + <span class="emphasis"><em>n</em></span> - 1 in | |
69 | the array will be replaced with the new values. If | |
70 | <em class="parameter"><code>m</code></em> + <em class="parameter"><code>n</code></em> - 1 is | |
71 | larger than the size of the uniform variable array, values for | |
72 | all array elements beyond the end of the array will be ignored. | |
73 | The number specified in the name of the command indicates the | |
74 | number of components for each element in | |
75 | <em class="parameter"><code>value</code></em>, and it should match the number of | |
76 | components in the data type of the specified uniform variable | |
77 | (e.g., <code class="function">1</code> for float, int, bool; | |
78 | <code class="function">2</code> for vec2, ivec2, bvec2, etc.). The data | |
79 | type specified in the name of the command must match the data | |
80 | type for the specified uniform variable as described previously | |
81 | for <code class="function">glUniform{1|2|3|4}{f|i}</code>.</p><p>For uniform variable arrays, each element of the array is | |
82 | considered to be of the type indicated in the name of the | |
83 | command (e.g., <code class="function">glUniform3f</code> or | |
84 | <code class="function">glUniform3fv</code> can be used to load a uniform | |
85 | variable array of type vec3). The number of elements of the | |
86 | uniform variable array to be modified is specified by | |
87 | <em class="parameter"><code>count</code></em></p><p>The commands | |
88 | <code class="function">glUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv</code> | |
89 | are used to modify a matrix or an array of matrices. The numbers in the | |
90 | command name are interpreted as the dimensionality of the matrix. | |
91 | The number <code class="function">2</code> indicates a 2 × 2 matrix | |
92 | (i.e., 4 values), the number <code class="function">3</code> indicates a | |
93 | 3 × 3 matrix (i.e., 9 values), and the number | |
94 | <code class="function">4</code> indicates a 4 × 4 matrix (i.e., 16 | |
95 | values). Non-square matrix dimensionality is explicit, with the first | |
96 | number representing the number of columns and the second number | |
97 | representing the number of rows. For example, | |
98 | <code class="function">2x4</code> indicates a 2 × 4 matrix with 2 columns | |
99 | and 4 rows (i.e., 8 values). | |
100 | If <em class="parameter"><code>transpose</code></em> is | |
101 | <code class="constant">GL_FALSE</code>, each matrix is assumed to be | |
102 | supplied in column major order. If | |
103 | <em class="parameter"><code>transpose</code></em> is | |
104 | <code class="constant">GL_TRUE</code>, each matrix is assumed to be | |
105 | supplied in row major order. The <em class="parameter"><code>count</code></em> | |
106 | argument indicates the number of matrices to be passed. A count | |
107 | of 1 should be used if modifying the value of a single matrix, | |
108 | and a count greater than 1 can be used to modify an array of | |
109 | matrices.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p><code class="function">glUniform</code> is available only if the GL | |
110 | version is 2.0 or greater.</p><p><code class="function">glUniformMatrix{2x3|3x2|2x4|4x2|3x4|4x3}fv</code> | |
111 | is available only if the GL version is 2.1 or greater.</p><p><code class="function">glUniform1i</code> and | |
112 | <code class="function">glUniform1iv</code> are the only two functions | |
113 | that may be used to load uniform variables defined as sampler | |
114 | types. Loading samplers with any other function will result in a | |
115 | <code class="constant">GL_INVALID_OPERATION</code> error.</p><p>If <em class="parameter"><code>count</code></em> is greater than 1 and the | |
116 | indicated uniform variable is not an array, a | |
117 | <code class="constant">GL_INVALID_OPERATION</code> error is generated and the | |
118 | specified uniform variable will remain unchanged.</p><p>Other than the preceding exceptions, if the type and size | |
119 | of the uniform variable as defined in the shader do not match | |
120 | the type and size specified in the name of the command used to | |
121 | load its value, a <code class="constant">GL_INVALID_OPERATION</code> error will | |
122 | be generated and the specified uniform variable will remain | |
123 | unchanged.</p><p>If <em class="parameter"><code>location</code></em> is a value other than | |
124 | -1 and it does not represent a valid uniform variable location | |
125 | in the current program object, an error will be generated, and | |
126 | no changes will be made to the uniform variable storage of the | |
127 | current program object. If <em class="parameter"><code>location</code></em> is | |
128 | equal to -1, the data passed in will be silently ignored and the | |
129 | specified uniform variable will not be changed.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p><code class="constant">GL_INVALID_OPERATION</code> is generated if there | |
130 | is no current program object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if the | |
131 | size of the uniform variable declared in the shader does not | |
132 | match the size indicated by the <code class="function">glUniform</code> | |
133 | command.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if one of | |
134 | the integer variants of this function is used to load a uniform | |
135 | variable of type float, vec2, vec3, vec4, or an array of these, | |
136 | or if one of the floating-point variants of this function is | |
137 | used to load a uniform variable of type int, ivec2, ivec3, or | |
138 | ivec4, or an array of these.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
139 | <em class="parameter"><code>location</code></em> is an invalid uniform location | |
140 | for the current program object and | |
141 | <em class="parameter"><code>location</code></em> is not equal to -1.</p><p><code class="constant">GL_INVALID_VALUE</code> is generated if | |
142 | <em class="parameter"><code>count</code></em> is less than 0.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
143 | <em class="parameter"><code>count</code></em> is greater than 1 and the indicated | |
144 | uniform variable is not an array variable.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if a | |
145 | sampler is loaded using a command other than | |
146 | <code class="function">glUniform1i</code> and | |
147 | <code class="function">glUniform1iv</code>.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
148 | <code class="function">glUniform</code> is executed between the execution | |
149 | of | |
150 | <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> | |
151 | and the corresponding execution of | |
152 | <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> | |
153 | with the argument <code class="constant">GL_CURRENT_PROGRAM</code></p><p><a class="citerefentry" href="glGetActiveUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveUniform</span></span></a> | |
154 | with the handle of a program object and the index of an active uniform variable</p><p><a class="citerefentry" href="glGetUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniform</span></span></a> | |
155 | with the handle of a program object and the location of a | |
156 | uniform variable</p><p><a class="citerefentry" href="glGetUniformLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniformLocation</span></span></a> | |
157 | with the handle of a program object and the name of a uniform | |
158 | variable</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p><a class="citerefentry" href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>, | |
159 | <a class="citerefentry" href="glUseProgram.xml"><span class="citerefentry"><span class="refentrytitle">glUseProgram</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
160 | Copyright <span class="trademark"></span>© 2003-2005 3Dlabs Inc. Ltd. | |
161 | This material may be distributed subject to the terms and conditions set forth in | |
162 | the Open Publication License, v 1.0, 8 June 1999. | |
163 | <a class="ulink" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
164 | </p></div></div></body></html> |