| 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="glProgramUniform"> |
| 5 | <refmeta> |
| 6 | <refentrytitle>glProgramUniform</refentrytitle> |
| 7 | <manvolnum>3G</manvolnum> |
| 8 | </refmeta> |
| 9 | <refnamediv> |
| 10 | <refdescriptor>glProgramUniform</refdescriptor> |
| 11 | <refname>glProgramUniform1f</refname> |
| 12 | <refname>glProgramUniform2f</refname> |
| 13 | <refname>glProgramUniform3f</refname> |
| 14 | <refname>glProgramUniform4f</refname> |
| 15 | <refname>glProgramUniform1i</refname> |
| 16 | <refname>glProgramUniform2i</refname> |
| 17 | <refname>glProgramUniform3i</refname> |
| 18 | <refname>glProgramUniform4i</refname> |
| 19 | <refname>glProgramUniform1ui</refname> |
| 20 | <refname>glProgramUniform2ui</refname> |
| 21 | <refname>glProgramUniform3ui</refname> |
| 22 | <refname>glProgramUniform4ui</refname> |
| 23 | <refname>glProgramUniform1fv</refname> |
| 24 | <refname>glProgramUniform2fv</refname> |
| 25 | <refname>glProgramUniform3fv</refname> |
| 26 | <refname>glProgramUniform4fv</refname> |
| 27 | <refname>glProgramUniform1iv</refname> |
| 28 | <refname>glProgramUniform2iv</refname> |
| 29 | <refname>glProgramUniform3iv</refname> |
| 30 | <refname>glProgramUniform4iv</refname> |
| 31 | <refname>glProgramUniform1uiv</refname> |
| 32 | <refname>glProgramUniform2uiv</refname> |
| 33 | <refname>glProgramUniform3uiv</refname> |
| 34 | <refname>glProgramUniform4uiv</refname> |
| 35 | <refname>glProgramUniformMatrix2fv</refname> |
| 36 | <refname>glProgramUniformMatrix3fv</refname> |
| 37 | <refname>glProgramUniformMatrix4fv</refname> |
| 38 | <refname>glProgramUniformMatrix2x3fv</refname> |
| 39 | <refname>glProgramUniformMatrix3x2fv</refname> |
| 40 | <refname>glProgramUniformMatrix2x4fv</refname> |
| 41 | <refname>glProgramUniformMatrix4x2fv</refname> |
| 42 | <refname>glProgramUniformMatrix3x4fv</refname> |
| 43 | <refname>glProgramUniformMatrix4x3fv</refname> |
| 44 | <refpurpose>Specify the value of a uniform variable for a specified program object</refpurpose> |
| 45 | </refnamediv> |
| 46 | <refsynopsisdiv><title>C Specification</title> |
| 47 | <funcsynopsis> |
| 48 | <funcprototype> |
| 49 | <funcdef>void <function>glProgramUniform1f</function></funcdef> |
| 50 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 51 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 52 | <paramdef>GLfloat <parameter>v0</parameter></paramdef> |
| 53 | </funcprototype> |
| 54 | <funcprototype> |
| 55 | <funcdef>void <function>glProgramUniform2f</function></funcdef> |
| 56 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 57 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 58 | <paramdef>GLfloat <parameter>v0</parameter></paramdef> |
| 59 | <paramdef>GLfloat <parameter>v1</parameter></paramdef> |
| 60 | </funcprototype> |
| 61 | <funcprototype> |
| 62 | <funcdef>void <function>glProgramUniform3f</function></funcdef> |
| 63 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 64 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 65 | <paramdef>GLfloat <parameter>v0</parameter></paramdef> |
| 66 | <paramdef>GLfloat <parameter>v1</parameter></paramdef> |
| 67 | <paramdef>GLfloat <parameter>v2</parameter></paramdef> |
| 68 | </funcprototype> |
| 69 | <funcprototype> |
| 70 | <funcdef>void <function>glProgramUniform4f</function></funcdef> |
| 71 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 72 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 73 | <paramdef>GLfloat <parameter>v0</parameter></paramdef> |
| 74 | <paramdef>GLfloat <parameter>v1</parameter></paramdef> |
| 75 | <paramdef>GLfloat <parameter>v2</parameter></paramdef> |
| 76 | <paramdef>GLfloat <parameter>v3</parameter></paramdef> |
| 77 | </funcprototype> |
| 78 | <funcprototype> |
| 79 | <funcdef>void <function>glProgramUniform1i</function></funcdef> |
| 80 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 81 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 82 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 83 | </funcprototype> |
| 84 | <funcprototype> |
| 85 | <funcdef>void <function>glProgramUniform2i</function></funcdef> |
| 86 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 87 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 88 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 89 | <paramdef>GLint <parameter>v1</parameter></paramdef> |
| 90 | </funcprototype> |
| 91 | <funcprototype> |
| 92 | <funcdef>void <function>glProgramUniform3i</function></funcdef> |
| 93 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 94 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 95 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 96 | <paramdef>GLint <parameter>v1</parameter></paramdef> |
| 97 | <paramdef>GLint <parameter>v2</parameter></paramdef> |
| 98 | </funcprototype> |
| 99 | <funcprototype> |
| 100 | <funcdef>void <function>glProgramUniform4i</function></funcdef> |
| 101 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 102 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 103 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 104 | <paramdef>GLint <parameter>v1</parameter></paramdef> |
| 105 | <paramdef>GLint <parameter>v2</parameter></paramdef> |
| 106 | <paramdef>GLint <parameter>v3</parameter></paramdef> |
| 107 | </funcprototype> |
| 108 | <funcprototype> |
| 109 | <funcdef>void <function>glProgramUniform1ui</function></funcdef> |
| 110 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 111 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 112 | <paramdef>GLuint <parameter>v0</parameter></paramdef> |
| 113 | </funcprototype> |
| 114 | <funcprototype> |
| 115 | <funcdef>void <function>glProgramUniform2ui</function></funcdef> |
| 116 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 117 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 118 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 119 | <paramdef>GLuint <parameter>v1</parameter></paramdef> |
| 120 | </funcprototype> |
| 121 | <funcprototype> |
| 122 | <funcdef>void <function>glProgramUniform3ui</function></funcdef> |
| 123 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 124 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 125 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 126 | <paramdef>GLint <parameter>v1</parameter></paramdef> |
| 127 | <paramdef>GLuint <parameter>v2</parameter></paramdef> |
| 128 | </funcprototype> |
| 129 | <funcprototype> |
| 130 | <funcdef>void <function>glProgramUniform4ui</function></funcdef> |
| 131 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 132 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 133 | <paramdef>GLint <parameter>v0</parameter></paramdef> |
| 134 | <paramdef>GLint <parameter>v1</parameter></paramdef> |
| 135 | <paramdef>GLint <parameter>v2</parameter></paramdef> |
| 136 | <paramdef>GLuint <parameter>v3</parameter></paramdef> |
| 137 | </funcprototype> |
| 138 | </funcsynopsis> |
| 139 | </refsynopsisdiv> |
| 140 | <refsect1 id="parameters"><title>Parameters</title> |
| 141 | <variablelist> |
| 142 | <varlistentry> |
| 143 | <term><parameter>program</parameter></term> |
| 144 | <listitem> |
| 145 | <para>Specifies the handle of the program containing the uniform |
| 146 | variable to be modified.</para> |
| 147 | </listitem> |
| 148 | </varlistentry> |
| 149 | <varlistentry> |
| 150 | <term><parameter>location</parameter></term> |
| 151 | <listitem> |
| 152 | <para>Specifies the location of the uniform variable |
| 153 | to be modified.</para> |
| 154 | </listitem> |
| 155 | </varlistentry> |
| 156 | <varlistentry> |
| 157 | <term> |
| 158 | <parameter>v0</parameter>, |
| 159 | <parameter>v1</parameter>, |
| 160 | <parameter>v2</parameter>, |
| 161 | <parameter>v3</parameter> |
| 162 | </term> |
| 163 | <listitem> |
| 164 | <para>Specifies the new values to be used for the |
| 165 | specified uniform variable.</para> |
| 166 | </listitem> |
| 167 | </varlistentry> |
| 168 | </variablelist> |
| 169 | </refsect1> |
| 170 | <refsynopsisdiv><title>C Specification</title> |
| 171 | <funcsynopsis> |
| 172 | <funcprototype> |
| 173 | <funcdef>void <function>glProgramUniform1fv</function></funcdef> |
| 174 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 175 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 176 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 177 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 178 | </funcprototype> |
| 179 | <funcprototype> |
| 180 | <funcdef>void <function>glProgramUniform2fv</function></funcdef> |
| 181 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 182 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 183 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 184 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 185 | </funcprototype> |
| 186 | <funcprototype> |
| 187 | <funcdef>void <function>glProgramUniform3fv</function></funcdef> |
| 188 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 189 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 190 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 191 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 192 | </funcprototype> |
| 193 | <funcprototype> |
| 194 | <funcdef>void <function>glProgramUniform4fv</function></funcdef> |
| 195 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 196 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 197 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 198 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 199 | </funcprototype> |
| 200 | <funcprototype> |
| 201 | <funcdef>void <function>glProgramUniform1iv</function></funcdef> |
| 202 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 203 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 204 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 205 | <paramdef>const GLint *<parameter>value</parameter></paramdef> |
| 206 | </funcprototype> |
| 207 | <funcprototype> |
| 208 | <funcdef>void <function>glProgramUniform2iv</function></funcdef> |
| 209 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 210 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 211 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 212 | <paramdef>const GLint *<parameter>value</parameter></paramdef> |
| 213 | </funcprototype> |
| 214 | <funcprototype> |
| 215 | <funcdef>void <function>glProgramUniform3iv</function></funcdef> |
| 216 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 217 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 218 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 219 | <paramdef>const GLint *<parameter>value</parameter></paramdef> |
| 220 | </funcprototype> |
| 221 | <funcprototype> |
| 222 | <funcdef>void <function>glProgramUniform4iv</function></funcdef> |
| 223 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 224 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 225 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 226 | <paramdef>const GLint *<parameter>value</parameter></paramdef> |
| 227 | </funcprototype> |
| 228 | <funcprototype> |
| 229 | <funcdef>void <function>glProgramUniform1uiv</function></funcdef> |
| 230 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 231 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 232 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 233 | <paramdef>const GLuint *<parameter>value</parameter></paramdef> |
| 234 | </funcprototype> |
| 235 | <funcprototype> |
| 236 | <funcdef>void <function>glProgramUniform2uiv</function></funcdef> |
| 237 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 238 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 239 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 240 | <paramdef>const GLuint *<parameter>value</parameter></paramdef> |
| 241 | </funcprototype> |
| 242 | <funcprototype> |
| 243 | <funcdef>void <function>glProgramUniform3uiv</function></funcdef> |
| 244 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 245 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 246 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 247 | <paramdef>const GLuint *<parameter>value</parameter></paramdef> |
| 248 | </funcprototype> |
| 249 | <funcprototype> |
| 250 | <funcdef>void <function>glProgramUniform4uiv</function></funcdef> |
| 251 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 252 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 253 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 254 | <paramdef>const GLuint *<parameter>value</parameter></paramdef> |
| 255 | </funcprototype> |
| 256 | </funcsynopsis> |
| 257 | </refsynopsisdiv> |
| 258 | <refsect1 id="parameters2"><title>Parameters</title> |
| 259 | <variablelist> |
| 260 | <varlistentry> |
| 261 | <term><parameter>program</parameter></term> |
| 262 | <listitem> |
| 263 | <para>Specifies the handle of the program containing the uniform |
| 264 | variable to be modified.</para> |
| 265 | </listitem> |
| 266 | </varlistentry> |
| 267 | <varlistentry> |
| 268 | <term><parameter>location</parameter></term> |
| 269 | <listitem> |
| 270 | <para>Specifies the location of the uniform value to |
| 271 | be modified.</para> |
| 272 | </listitem> |
| 273 | </varlistentry> |
| 274 | <varlistentry> |
| 275 | <term><parameter>count</parameter></term> |
| 276 | <listitem> |
| 277 | <para>Specifies the number of elements that are to |
| 278 | be modified. This should be 1 if the targeted |
| 279 | uniform variable is not an array, and 1 or more if it is |
| 280 | an array.</para> |
| 281 | </listitem> |
| 282 | </varlistentry> |
| 283 | <varlistentry> |
| 284 | <term><parameter>value</parameter></term> |
| 285 | <listitem> |
| 286 | <para>Specifies a pointer to an array of |
| 287 | <parameter>count</parameter> values that will be |
| 288 | used to update the specified uniform |
| 289 | variable.</para> |
| 290 | </listitem> |
| 291 | </varlistentry> |
| 292 | </variablelist> |
| 293 | </refsect1> |
| 294 | <refsynopsisdiv><title>C Specification</title> |
| 295 | <funcsynopsis> |
| 296 | <funcprototype> |
| 297 | <funcdef>void <function>glProgramUniformMatrix2fv</function></funcdef> |
| 298 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 299 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 300 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 301 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 302 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 303 | </funcprototype> |
| 304 | <funcprototype> |
| 305 | <funcdef>void <function>glProgramUniformMatrix3fv</function></funcdef> |
| 306 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 307 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 308 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 309 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 310 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 311 | </funcprototype> |
| 312 | <funcprototype> |
| 313 | <funcdef>void <function>glProgramUniformMatrix4fv</function></funcdef> |
| 314 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 315 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 316 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 317 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 318 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 319 | </funcprototype> |
| 320 | <funcprototype> |
| 321 | <funcdef>void <function>glProgramUniformMatrix2x3fv</function></funcdef> |
| 322 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 323 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 324 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 325 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 326 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 327 | </funcprototype> |
| 328 | <funcprototype> |
| 329 | <funcdef>void <function>glProgramUniformMatrix3x2fv</function></funcdef> |
| 330 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 331 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 332 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 333 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 334 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 335 | </funcprototype> |
| 336 | <funcprototype> |
| 337 | <funcdef>void <function>glProgramUniformMatrix2x4fv</function></funcdef> |
| 338 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 339 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 340 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 341 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 342 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 343 | </funcprototype> |
| 344 | <funcprototype> |
| 345 | <funcdef>void <function>glProgramUniformMatrix4x2fv</function></funcdef> |
| 346 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 347 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 348 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 349 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 350 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 351 | </funcprototype> |
| 352 | <funcprototype> |
| 353 | <funcdef>void <function>glProgramUniformMatrix3x4fv</function></funcdef> |
| 354 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 355 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 356 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 357 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 358 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 359 | </funcprototype> |
| 360 | <funcprototype> |
| 361 | <funcdef>void <function>glProgramUniformMatrix4x3fv</function></funcdef> |
| 362 | <paramdef>GLuint <parameter>program</parameter></paramdef> |
| 363 | <paramdef>GLint <parameter>location</parameter></paramdef> |
| 364 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 365 | <paramdef>GLboolean <parameter>transpose</parameter></paramdef> |
| 366 | <paramdef>const GLfloat *<parameter>value</parameter></paramdef> |
| 367 | </funcprototype> |
| 368 | </funcsynopsis> |
| 369 | </refsynopsisdiv> |
| 370 | <refsect1 id="parameters3"><title>Parameters</title> |
| 371 | <variablelist> |
| 372 | <varlistentry> |
| 373 | <term><parameter>program</parameter></term> |
| 374 | <listitem> |
| 375 | <para>Specifies the handle of the program containing the uniform |
| 376 | variable to be modified.</para> |
| 377 | </listitem> |
| 378 | </varlistentry> |
| 379 | <varlistentry> |
| 380 | <term><parameter>location</parameter></term> |
| 381 | <listitem> |
| 382 | <para>Specifies the location of the uniform value to |
| 383 | be modified.</para> |
| 384 | </listitem> |
| 385 | </varlistentry> |
| 386 | <varlistentry> |
| 387 | <term><parameter>count</parameter></term> |
| 388 | <listitem> |
| 389 | <para>Specifies the number of matrices that are to |
| 390 | be modified. This should be 1 if the targeted |
| 391 | uniform variable is not an array of matrices, and 1 or more if it is |
| 392 | an array of matrices.</para> |
| 393 | </listitem> |
| 394 | </varlistentry> |
| 395 | <varlistentry> |
| 396 | <term><parameter>transpose</parameter></term> |
| 397 | <listitem> |
| 398 | <para>Specifies whether to transpose the matrix as |
| 399 | the values are loaded into the uniform |
| 400 | variable.</para> |
| 401 | </listitem> |
| 402 | </varlistentry> |
| 403 | <varlistentry> |
| 404 | <term><parameter>value</parameter></term> |
| 405 | <listitem> |
| 406 | <para>Specifies a pointer to an array of |
| 407 | <parameter>count</parameter> values that will be |
| 408 | used to update the specified uniform |
| 409 | variable.</para> |
| 410 | </listitem> |
| 411 | </varlistentry> |
| 412 | </variablelist> |
| 413 | </refsect1> |
| 414 | <refsect1 id="description"><title>Description</title> |
| 415 | <para><function>glProgramUniform</function> modifies the value of a |
| 416 | uniform variable or a uniform variable array. The location of |
| 417 | the uniform variable to be modified is specified by |
| 418 | <parameter>location</parameter>, which should be a value |
| 419 | returned by |
| 420 | <citerefentry><refentrytitle>glGetUniformLocation</refentrytitle></citerefentry>. |
| 421 | <function>glProgramUniform</function> operates on the program object |
| 422 | specified by <parameter>program</parameter>.</para> |
| 423 | |
| 424 | <para>The commands <function>glProgramUniform{1|2|3|4}{f|i|ui}</function> |
| 425 | are used to change the value of the uniform variable specified |
| 426 | by <parameter>location</parameter> using the values passed as |
| 427 | arguments. The number specified in the command should match the |
| 428 | number of components in the data type of the specified uniform |
| 429 | variable (e.g., <function>1</function> for <code>float</code>, <code>int</code>, <code>unsigned int</code>, <code>bool</code>; |
| 430 | <function>2</function> for <code>vec2</code>, <code>ivec2</code>, <code>uvec2</code>, <code>bvec2</code>, etc.). The suffix |
| 431 | <function>f</function> indicates that floating-point values are |
| 432 | being passed; the suffix <function>i</function> indicates that |
| 433 | integer values are being passed; the suffix <function>ui</function> indicates that |
| 434 | unsigned integer values are being passed, and this type should also match |
| 435 | the data type of the specified uniform variable. The |
| 436 | <function>i</function> variants of this function should be used |
| 437 | to provide values for uniform variables defined as <code>int</code>, <code>ivec2</code>, |
| 438 | <code>ivec3</code>, <code>ivec4</code>, or arrays of these. The |
| 439 | <function>ui</function> variants of this function should be used |
| 440 | to provide values for uniform variables defined as <code>unsigned int</code>, <code>uvec2</code>, |
| 441 | <code>uvec3</code>, <code>uvec4</code>, or arrays of these. The <function>f</function> |
| 442 | variants should be used to provide values for uniform variables |
| 443 | of type <code>float</code>, <code>vec2</code>, <code>vec3</code>, <code>vec4</code>, or arrays of these. Either the |
| 444 | <function>i</function>, <function>ui</function> or <function>f</function> variants |
| 445 | may be used to provide values for uniform variables of type |
| 446 | <code>bool</code>, <code>bvec2</code>, <code>bvec3</code>, <code>bvec4</code>, or arrays of these. The uniform |
| 447 | variable will be set to <code>false</code> if the input value is 0 or 0.0f, |
| 448 | and it will be set to <code>true</code> otherwise.</para> |
| 449 | |
| 450 | <para>All active uniform variables defined in a program object |
| 451 | are initialized to 0 when the program object is linked |
| 452 | successfully. They retain the values assigned to them by a call |
| 453 | to <function>glProgramUniform</function> until the next successful |
| 454 | link operation occurs on the program object, when they are once |
| 455 | again initialized to 0.</para> |
| 456 | |
| 457 | <para>The commands <function>glProgramUniform{1|2|3|4}{f|i|ui}v</function> |
| 458 | can be used to modify a single uniform variable or a uniform |
| 459 | variable array. These commands pass a count and a pointer to the |
| 460 | values to be loaded into a uniform variable or a uniform |
| 461 | variable array. A count of 1 should be used if modifying the |
| 462 | value of a single uniform variable, and a count of 1 or greater |
| 463 | can be used to modify an entire array or part of an array. When |
| 464 | loading <emphasis>n</emphasis> elements starting at an arbitrary |
| 465 | position <emphasis>m</emphasis> in a uniform variable array, |
| 466 | elements <emphasis>m</emphasis> + <emphasis>n</emphasis> - 1 in |
| 467 | the array will be replaced with the new values. If |
| 468 | <parameter>m</parameter> + <parameter>n</parameter> - 1 is |
| 469 | larger than the size of the uniform variable array, values for |
| 470 | all array elements beyond the end of the array will be ignored. |
| 471 | The number specified in the name of the command indicates the |
| 472 | number of components for each element in |
| 473 | <parameter>value</parameter>, and it should match the number of |
| 474 | components in the data type of the specified uniform variable |
| 475 | (e.g., <function>1</function> for <code>float</code>, <code>int</code>, <code>bool</code>; |
| 476 | <function>2</function> for <code>vec2</code>, <code>ivec2</code>, <code>bvec2</code>, etc.). The data |
| 477 | type specified in the name of the command must match the data |
| 478 | type for the specified uniform variable as described previously |
| 479 | for <function>glProgramUniform{1|2|3|4}{f|i|ui}</function>.</para> |
| 480 | |
| 481 | <para>For uniform variable arrays, each element of the array is |
| 482 | considered to be of the type indicated in the name of the |
| 483 | command (e.g., <function>glProgramUniform3f</function> or |
| 484 | <function>glProgramUniform3fv</function> can be used to load a uniform |
| 485 | variable array of type vec3). The number of elements of the |
| 486 | uniform variable array to be modified is specified by |
| 487 | <parameter>count</parameter></para> |
| 488 | |
| 489 | <para>The commands |
| 490 | <function>glProgramUniformMatrix{2|3|4|2x3|3x2|2x4|4x2|3x4|4x3}fv</function> |
| 491 | are used to modify a matrix or an array of matrices. The numbers in the |
| 492 | command name are interpreted as the dimensionality of the matrix. |
| 493 | The number <function>2</function> indicates a 2 × 2 matrix |
| 494 | (i.e., 4 values), the number <function>3</function> indicates a |
| 495 | 3 × 3 matrix (i.e., 9 values), and the number |
| 496 | <function>4</function> indicates a 4 × 4 matrix (i.e., 16 |
| 497 | values). Non-square matrix dimensionality is explicit, with the first |
| 498 | number representing the number of columns and the second number |
| 499 | representing the number of rows. For example, |
| 500 | <function>2x4</function> indicates a 2 × 4 matrix with 2 columns |
| 501 | and 4 rows (i.e., 8 values). |
| 502 | If <parameter>transpose</parameter> is |
| 503 | <constant>GL_FALSE</constant>, each matrix is assumed to be |
| 504 | supplied in column major order. If |
| 505 | <parameter>transpose</parameter> is |
| 506 | <constant>GL_TRUE</constant>, each matrix is assumed to be |
| 507 | supplied in row major order. The <parameter>count</parameter> |
| 508 | argument indicates the number of matrices to be passed. A count |
| 509 | of 1 should be used if modifying the value of a single matrix, |
| 510 | and a count greater than 1 can be used to modify an array of |
| 511 | matrices.</para> |
| 512 | </refsect1> |
| 513 | <refsect1 id="notes"><title>Notes</title> |
| 514 | <para><function>glProgramUniform1i</function> and |
| 515 | <function>glProgramUniform1iv</function> are the only two functions |
| 516 | that may be used to load uniform variables defined as sampler |
| 517 | types. Loading samplers with any other function will result in a |
| 518 | <constant>GL_INVALID_OPERATION</constant> error.</para> |
| 519 | |
| 520 | <para>If <parameter>count</parameter> is greater than 1 and the |
| 521 | indicated uniform variable is not an array, a |
| 522 | <constant>GL_INVALID_OPERATION</constant> error is generated and the |
| 523 | specified uniform variable will remain unchanged.</para> |
| 524 | |
| 525 | <para>Other than the preceding exceptions, if the type and size |
| 526 | of the uniform variable as defined in the shader do not match |
| 527 | the type and size specified in the name of the command used to |
| 528 | load its value, a <constant>GL_INVALID_OPERATION</constant> error will |
| 529 | be generated and the specified uniform variable will remain |
| 530 | unchanged.</para> |
| 531 | |
| 532 | <para>If <parameter>location</parameter> is a value other than |
| 533 | -1 and it does not represent a valid uniform variable location |
| 534 | in within <parameter>program</parameter>, an error will be generated, and |
| 535 | no changes will be made to the uniform variable storage of |
| 536 | <parameter>program</parameter>. If <parameter>location</parameter> is |
| 537 | equal to -1, the data passed in will be silently ignored and the |
| 538 | specified uniform variable will not be changed.</para> |
| 539 | </refsect1> |
| 540 | <refsect1 id="errors"><title>Errors</title> |
| 541 | <para><constant>GL_INVALID_OPERATION</constant> is generated if |
| 542 | <parameter>program</parameter> does not refer to a program object owned |
| 543 | by the GL.</para> |
| 544 | |
| 545 | <para><constant>GL_INVALID_OPERATION</constant> is generated if the |
| 546 | size of the uniform variable declared in the shader does not |
| 547 | match the size indicated by the <function>glProgramUniform</function> |
| 548 | command.</para> |
| 549 | |
| 550 | <para><constant>GL_INVALID_OPERATION</constant> is generated if one of |
| 551 | the signed or unsigned integer variants of this function is used to load a uniform |
| 552 | variable of type <code>float</code>, <code>vec2</code>, <code>vec3</code>, <code>vec4</code>, or an array of these, |
| 553 | or if one of the floating-point variants of this function is |
| 554 | used to load a uniform variable of type <code>int</code>, <code>ivec2</code>, <code>ivec3</code>, |
| 555 | <code>ivec4</code>, <code>unsigned int</code>, <code>uvec2</code>, <code>uvec3</code>, |
| 556 | <code>uvec4</code>, or an array of these.</para> |
| 557 | |
| 558 | <para><constant>GL_INVALID_OPERATION</constant> is generated if one of |
| 559 | the signed integer variants of this function is used to load a uniform |
| 560 | variable of type <code>unsigned int</code>, <code>uvec2</code>, <code>uvec3</code>, |
| 561 | <code>uvec4</code>, or an array of these.</para> |
| 562 | |
| 563 | <para><constant>GL_INVALID_OPERATION</constant> is generated if one of |
| 564 | the unsigned integer variants of this function is used to load a uniform |
| 565 | variable of type <code>int</code>, <code>ivec2</code>, <code>ivec3</code>, |
| 566 | <code>ivec4</code>, or an array of these.</para> |
| 567 | |
| 568 | <para><constant>GL_INVALID_OPERATION</constant> is generated if |
| 569 | <parameter>location</parameter> is an invalid uniform location |
| 570 | for <parameter>program</parameter> and |
| 571 | <parameter>location</parameter> is not equal to -1.</para> |
| 572 | |
| 573 | <para><constant>GL_INVALID_VALUE</constant> is generated if |
| 574 | <parameter>count</parameter> is less than 0.</para> |
| 575 | |
| 576 | <para><constant>GL_INVALID_OPERATION</constant> is generated if |
| 577 | <parameter>count</parameter> is greater than 1 and the indicated |
| 578 | uniform variable is not an array variable.</para> |
| 579 | |
| 580 | <para><constant>GL_INVALID_OPERATION</constant> is generated if a |
| 581 | sampler is loaded using a command other than |
| 582 | <function>glProgramUniform1i</function> and |
| 583 | <function>glProgramUniform1iv</function>.</para> |
| 584 | |
| 585 | </refsect1> |
| 586 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 587 | <para><citerefentry><refentrytitle>glGetActiveUniform</refentrytitle></citerefentry> |
| 588 | with the handle of a program object and the index of an active uniform variable</para> |
| 589 | |
| 590 | <para><citerefentry><refentrytitle>glGetUniform</refentrytitle></citerefentry> |
| 591 | with the handle of a program object and the location of a |
| 592 | uniform variable</para> |
| 593 | |
| 594 | <para><citerefentry><refentrytitle>glGetUniformLocation</refentrytitle></citerefentry> |
| 595 | with the handle of a program object and the name of a uniform |
| 596 | variable</para> |
| 597 | </refsect1> |
| 598 | <refsect1 id="seealso"><title>See Also</title> |
| 599 | <para><citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>, |
| 600 | <citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry></para> |
| 601 | </refsect1> |
| 602 | <refsect1 id="Copyright"><title>Copyright</title> |
| 603 | <para> |
| 604 | Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd. |
| 605 | Copyright <trademark class="copyright"></trademark> 2010 Khronos Group. |
| 606 | This material may be distributed subject to the terms and conditions set forth in |
| 607 | the Open Publication License, v 1.0, 8 June 1999. |
| 608 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. |
| 609 | </para> |
| 610 | </refsect1> |
| 611 | </refentry> |