Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> | |
3 | <!-- saved from url=(0013)about:internet --> | |
4 | <?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" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glProgramUniform - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glProgramUniform"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glProgramUniform — Specify the value of a uniform variable for a specified 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">glProgramUniform1f</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform2f</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform3f</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform4f</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform1i</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform2i</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform3i</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glProgramUniform4i</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">void <b class="fsfunc">glProgramUniform1ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">location</var>, </td></tr><tr><td> </td><td>GLuint </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">glProgramUniform2ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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>GLuint </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">glProgramUniform3ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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>GLuint </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">glProgramUniform4ui</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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>GLuint </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>program</code></em></span></dt><dd><p>Specifies the handle of the program containing the uniform | |
5 | variable to be modified.</p></dd><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform variable | |
6 | to be modified.</p></dd><dt><span class="term"> | |
7 | <em class="parameter"><code>v0</code></em>, | |
8 | <em class="parameter"><code>v1</code></em>, | |
9 | <em class="parameter"><code>v2</code></em>, | |
10 | <em class="parameter"><code>v3</code></em> | |
11 | </span></dt><dd><p>Specifies the new values to be used for the | |
12 | 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">glProgramUniform1fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform2fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform3fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform4fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform1iv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform2iv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform3iv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform4iv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniform1uiv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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 GLuint * </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">glProgramUniform2uiv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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 GLuint * </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">glProgramUniform3uiv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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 GLuint * </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">glProgramUniform4uiv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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 GLuint * </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>program</code></em></span></dt><dd><p>Specifies the handle of the program containing the uniform | |
13 | variable to be modified.</p></dd><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform value to | |
14 | 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 | |
15 | be modified. This should be 1 if the targeted | |
16 | uniform variable is not an array, and 1 or more if it is | |
17 | 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 | |
18 | <em class="parameter"><code>count</code></em> values that will be | |
19 | used to update the specified uniform | |
20 | 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">glProgramUniformMatrix2fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix3fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix4fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix2x3fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix3x2fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix2x4fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix4x2fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix3x4fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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">glProgramUniformMatrix4x3fv</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </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>program</code></em></span></dt><dd><p>Specifies the handle of the program containing the uniform | |
21 | variable to be modified.</p></dd><dt><span class="term"><em class="parameter"><code>location</code></em></span></dt><dd><p>Specifies the location of the uniform value to | |
22 | 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 | |
23 | be modified. This should be 1 if the targeted | |
24 | uniform variable is not an array of matrices, and 1 or more if it is | |
25 | 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 | |
26 | the values are loaded into the uniform | |
27 | 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 | |
28 | <em class="parameter"><code>count</code></em> values that will be | |
29 | used to update the specified uniform | |
30 | 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">glProgramUniform</code> modifies the value of a | |
31 | uniform variable or a uniform variable array. The location of | |
32 | the uniform variable to be modified is specified by | |
33 | <em class="parameter"><code>location</code></em>, which should be a value | |
34 | returned by | |
35 | <a href="glGetUniformLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniformLocation</span></span></a>. | |
36 | <code class="function">glProgramUniform</code> operates on the program object | |
37 | specified by <em class="parameter"><code>program</code></em>.</p><p>The commands <code class="function">glProgramUniform{1|2|3|4}{f|i|ui}</code> | |
38 | are used to change the value of the uniform variable specified | |
39 | by <em class="parameter"><code>location</code></em> using the values passed as | |
40 | arguments. The number specified in the command should match the | |
41 | number of components in the data type of the specified uniform | |
42 | variable (e.g., <code class="function">1</code> for <code class="code">float</code>, <code class="code">int</code>, <code class="code">unsigned int</code>, <code class="code">bool</code>; | |
43 | <code class="function">2</code> for <code class="code">vec2</code>, <code class="code">ivec2</code>, <code class="code">uvec2</code>, <code class="code">bvec2</code>, etc.). The suffix | |
44 | <code class="function">f</code> indicates that floating-point values are | |
45 | being passed; the suffix <code class="function">i</code> indicates that | |
46 | integer values are being passed; the suffix <code class="function">ui</code> indicates that | |
47 | unsigned integer values are being passed, and this type should also match | |
48 | the data type of the specified uniform variable. The | |
49 | <code class="function">i</code> variants of this function should be used | |
50 | to provide values for uniform variables defined as <code class="code">int</code>, <code class="code">ivec2</code>, | |
51 | <code class="code">ivec3</code>, <code class="code">ivec4</code>, or arrays of these. The | |
52 | <code class="function">ui</code> variants of this function should be used | |
53 | to provide values for uniform variables defined as <code class="code">unsigned int</code>, <code class="code">uvec2</code>, | |
54 | <code class="code">uvec3</code>, <code class="code">uvec4</code>, or arrays of these. The <code class="function">f</code> | |
55 | variants should be used to provide values for uniform variables | |
56 | of type <code class="code">float</code>, <code class="code">vec2</code>, <code class="code">vec3</code>, <code class="code">vec4</code>, or arrays of these. Either the | |
57 | <code class="function">i</code>, <code class="function">ui</code> or <code class="function">f</code> variants | |
58 | may be used to provide values for uniform variables of type | |
59 | <code class="code">bool</code>, <code class="code">bvec2</code>, <code class="code">bvec3</code>, <code class="code">bvec4</code>, or arrays of these. The uniform | |
60 | variable will be set to <code class="code">false</code> if the input value is 0 or 0.0f, | |
61 | and it will be set to <code class="code">true</code> otherwise.</p><p>All active uniform variables defined in a program object | |
62 | are initialized to 0 when the program object is linked | |
63 | successfully. They retain the values assigned to them by a call | |
64 | to <code class="function">glProgramUniform</code> until the next successful | |
65 | link operation occurs on the program object, when they are once | |
66 | again initialized to 0.</p><p>The commands <code class="function">glProgramUniform{1|2|3|4}{f|i|ui}v</code> | |
67 | can be used to modify a single uniform variable or a uniform | |
68 | variable array. These commands pass a count and a pointer to the | |
69 | values to be loaded into a uniform variable or a uniform | |
70 | variable array. A count of 1 should be used if modifying the | |
71 | value of a single uniform variable, and a count of 1 or greater | |
72 | can be used to modify an entire array or part of an array. When | |
73 | loading <span class="emphasis"><em>n</em></span> elements starting at an arbitrary | |
74 | position <span class="emphasis"><em>m</em></span> in a uniform variable array, | |
75 | elements <span class="emphasis"><em>m</em></span> + <span class="emphasis"><em>n</em></span> - 1 in | |
76 | the array will be replaced with the new values. If | |
77 | <em class="parameter"><code>m</code></em> + <em class="parameter"><code>n</code></em> - 1 is | |
78 | larger than the size of the uniform variable array, values for | |
79 | all array elements beyond the end of the array will be ignored. | |
80 | The number specified in the name of the command indicates the | |
81 | number of components for each element in | |
82 | <em class="parameter"><code>value</code></em>, and it should match the number of | |
83 | components in the data type of the specified uniform variable | |
84 | (e.g., <code class="function">1</code> for <code class="code">float</code>, <code class="code">int</code>, <code class="code">bool</code>; | |
85 | <code class="function">2</code> for <code class="code">vec2</code>, <code class="code">ivec2</code>, <code class="code">bvec2</code>, etc.). The data | |
86 | type specified in the name of the command must match the data | |
87 | type for the specified uniform variable as described previously | |
88 | for <code class="function">glProgramUniform{1|2|3|4}{f|i|ui}</code>.</p><p>For uniform variable arrays, each element of the array is | |
89 | considered to be of the type indicated in the name of the | |
90 | command (e.g., <code class="function">glProgramUniform3f</code> or | |
91 | <code class="function">glProgramUniform3fv</code> can be used to load a uniform | |
92 | variable array of type vec3). The number of elements of the | |
93 | uniform variable array to be modified is specified by | |
94 | <em class="parameter"><code>count</code></em></p><p>The commands | |
95 | <code class="function">glProgramUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv</code> | |
96 | are used to modify a matrix or an array of matrices. The numbers in the | |
97 | command name are interpreted as the dimensionality of the matrix. | |
98 | The number <code class="function">2</code> indicates a 2 × 2 matrix | |
99 | (i.e., 4 values), the number <code class="function">3</code> indicates a | |
100 | 3 × 3 matrix (i.e., 9 values), and the number | |
101 | <code class="function">4</code> indicates a 4 × 4 matrix (i.e., 16 | |
102 | values). Non-square matrix dimensionality is explicit, with the first | |
103 | number representing the number of columns and the second number | |
104 | representing the number of rows. For example, | |
105 | <code class="function">2x4</code> indicates a 2 × 4 matrix with 2 columns | |
106 | and 4 rows (i.e., 8 values). | |
107 | If <em class="parameter"><code>transpose</code></em> is | |
108 | <code class="constant">GL_FALSE</code>, each matrix is assumed to be | |
109 | supplied in column major order. If | |
110 | <em class="parameter"><code>transpose</code></em> is | |
111 | <code class="constant">GL_TRUE</code>, each matrix is assumed to be | |
112 | supplied in row major order. The <em class="parameter"><code>count</code></em> | |
113 | argument indicates the number of matrices to be passed. A count | |
114 | of 1 should be used if modifying the value of a single matrix, | |
115 | and a count greater than 1 can be used to modify an array of | |
116 | matrices.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p><code class="function">glProgramUniform1i</code> and | |
117 | <code class="function">glProgramUniform1iv</code> are the only two functions | |
118 | that may be used to load uniform variables defined as sampler | |
119 | types. Loading samplers with any other function will result in a | |
120 | <code class="constant">GL_INVALID_OPERATION</code> error.</p><p>If <em class="parameter"><code>count</code></em> is greater than 1 and the | |
121 | indicated uniform variable is not an array, a | |
122 | <code class="constant">GL_INVALID_OPERATION</code> error is generated and the | |
123 | specified uniform variable will remain unchanged.</p><p>Other than the preceding exceptions, if the type and size | |
124 | of the uniform variable as defined in the shader do not match | |
125 | the type and size specified in the name of the command used to | |
126 | load its value, a <code class="constant">GL_INVALID_OPERATION</code> error will | |
127 | be generated and the specified uniform variable will remain | |
128 | unchanged.</p><p>If <em class="parameter"><code>location</code></em> is a value other than | |
129 | -1 and it does not represent a valid uniform variable location | |
130 | in within <em class="parameter"><code>program</code></em>, an error will be generated, and | |
131 | no changes will be made to the uniform variable storage of | |
132 | <em class="parameter"><code>program</code></em>. If <em class="parameter"><code>location</code></em> is | |
133 | equal to -1, the data passed in will be silently ignored and the | |
134 | 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 | |
135 | <em class="parameter"><code>program</code></em> does not refer to a program object owned | |
136 | by the GL.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if the | |
137 | size of the uniform variable declared in the shader does not | |
138 | match the size indicated by the <code class="function">glProgramUniform</code> | |
139 | command.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if one of | |
140 | the signed or unsigned integer variants of this function is used to load a uniform | |
141 | variable of type <code class="code">float</code>, <code class="code">vec2</code>, <code class="code">vec3</code>, <code class="code">vec4</code>, or an array of these, | |
142 | or if one of the floating-point variants of this function is | |
143 | used to load a uniform variable of type <code class="code">int</code>, <code class="code">ivec2</code>, <code class="code">ivec3</code>, | |
144 | <code class="code">ivec4</code>, <code class="code">unsigned int</code>, <code class="code">uvec2</code>, <code class="code">uvec3</code>, | |
145 | <code class="code">uvec4</code>, or an array of these.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if one of | |
146 | the signed integer variants of this function is used to load a uniform | |
147 | variable of type <code class="code">unsigned int</code>, <code class="code">uvec2</code>, <code class="code">uvec3</code>, | |
148 | <code class="code">uvec4</code>, or an array of these.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if one of | |
149 | the unsigned integer variants of this function is used to load a uniform | |
150 | variable of type <code class="code">int</code>, <code class="code">ivec2</code>, <code class="code">ivec3</code>, | |
151 | <code class="code">ivec4</code>, or an array of these.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
152 | <em class="parameter"><code>location</code></em> is an invalid uniform location | |
153 | for <em class="parameter"><code>program</code></em> and | |
154 | <em class="parameter"><code>location</code></em> is not equal to -1.</p><p><code class="constant">GL_INVALID_VALUE</code> is generated if | |
155 | <em class="parameter"><code>count</code></em> is less than 0.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
156 | <em class="parameter"><code>count</code></em> is greater than 1 and the indicated | |
157 | uniform variable is not an array variable.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if a | |
158 | sampler is loaded using a command other than | |
159 | <code class="function">glProgramUniform1i</code> and | |
160 | <code class="function">glProgramUniform1iv</code>.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a href="glGetActiveUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveUniform</span></span></a> | |
161 | with the handle of a program object and the index of an active uniform variable</p><p><a href="glGetUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniform</span></span></a> | |
162 | with the handle of a program object and the location of a | |
163 | uniform variable</p><p><a href="glGetUniformLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniformLocation</span></span></a> | |
164 | with the handle of a program object and the name of a uniform | |
165 | variable</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p><a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>, | |
166 | <a 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> | |
167 | Copyright <span class="trademark"></span>© 2003-2005 3Dlabs Inc. Ltd. | |
168 | Copyright <span class="trademark"></span>© 2010 Khronos Group. | |
169 | This material may be distributed subject to the terms and conditions set forth in | |
170 | the Open Publication License, v 1.0, 8 June 1999. | |
171 | <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
172 | </p></div></div></body></html> |