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>glUseProgram - 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="glUseProgram"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glUseProgram — Installs a program object as part of current rendering state</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><p><code class="funcdef">void <b class="fsfunc">glUseProgram</b>(</code>GLuint <var class="pdparam">program</var><code>)</code>;</p></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 object | |
5 | whose executables are to be used as part of current | |
6 | rendering state.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p><code class="function">glUseProgram</code> installs the program | |
7 | object specified by <em class="parameter"><code>program</code></em> as part of | |
8 | current rendering state. One or more executables are created in | |
9 | a program object by successfully attaching shader objects to it | |
10 | with | |
11 | <a href="glAttachShader.xml"><span class="citerefentry"><span class="refentrytitle">glAttachShader</span></span></a>, | |
12 | successfully compiling the shader objects with | |
13 | <a href="glCompileShader.xml"><span class="citerefentry"><span class="refentrytitle">glCompileShader</span></span></a>, | |
14 | and successfully linking the program object with | |
15 | <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>. | |
16 | </p><p>A program object will contain an executable that will run | |
17 | on the vertex processor if it contains one or more shader | |
18 | objects of type <code class="constant">GL_VERTEX_SHADER</code> that have | |
19 | been successfully compiled and linked. A program object will contain an | |
20 | executable that will run on the geometry processor if it contains one or | |
21 | more shader objects of type <code class="constant">GL_GEOMETRY_SHADER</code> that | |
22 | have been successfully compiled and linked. | |
23 | Similarly, a program object will contain an executable that will run on the | |
24 | fragment processor if it contains one or more shader objects of type | |
25 | <code class="constant">GL_FRAGMENT_SHADER</code> that have been | |
26 | successfully compiled and linked.</p><p>While a program object is in use, applications are free to | |
27 | modify attached shader objects, compile attached shader objects, | |
28 | attach additional shader objects, and detach or delete shader | |
29 | objects. None of these operations will affect the executables | |
30 | that are part of the current state. However, relinking the | |
31 | program object that is currently in use will install the program | |
32 | object as part of the current rendering state if the link | |
33 | operation was successful (see | |
34 | <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a> | |
35 | ). If the program object currently in use is relinked | |
36 | unsuccessfully, its link status will be set to | |
37 | <code class="constant">GL_FALSE</code>, but the executables and | |
38 | associated state will remain part of the current state until a | |
39 | subsequent call to <code class="function">glUseProgram</code> removes it | |
40 | from use. After it is removed from use, it cannot be made part | |
41 | of current state until it has been successfully relinked.</p><p>If <em class="parameter"><code>program</code></em> is zero, then the current rendering | |
42 | state refers to an <span class="emphasis"><em>invalid</em></span> program object and the | |
43 | results of shader execution are undefined. However, this is not an error.</p><p>If <em class="parameter"><code>program</code></em> does not | |
44 | contain shader objects of type <code class="constant">GL_FRAGMENT_SHADER</code>, an | |
45 | executable will be installed on the vertex, and possibly geometry processors, | |
46 | but the results of fragment shader execution will be undefined.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>Like buffer and texture objects, the name space for | |
47 | program objects may be shared across a set of contexts, as long | |
48 | as the server sides of the contexts share the same address | |
49 | space. If the name space is shared across contexts, any attached | |
50 | objects and the data associated with those attached objects are | |
51 | shared as well.</p><p>Applications are responsible for providing the | |
52 | synchronization across API calls when objects are accessed from | |
53 | different execution threads.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p><code class="constant">GL_INVALID_VALUE</code> is generated if | |
54 | <em class="parameter"><code>program</code></em> is neither 0 nor a value | |
55 | generated by OpenGL.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
56 | <em class="parameter"><code>program</code></em> is not a program object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
57 | <em class="parameter"><code>program</code></em> could not be made part of current | |
58 | state.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
59 | transform feedback mode is active.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> | |
60 | with the argument <code class="constant">GL_CURRENT_PROGRAM</code></p><p><a href="glGetActiveAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveAttrib</span></span></a> | |
61 | with a valid program object and the index of an active attribute | |
62 | variable</p><p><a href="glGetActiveUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetActiveUniform</span></span></a> | |
63 | with a valid program object and the index of an active uniform | |
64 | variable</p><p><a href="glGetAttachedShaders.xml"><span class="citerefentry"><span class="refentrytitle">glGetAttachedShaders</span></span></a> | |
65 | with a valid program object</p><p><a href="glGetAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetAttribLocation</span></span></a> | |
66 | with a valid program object and the name of an attribute | |
67 | variable</p><p><a href="glGetProgram.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgram</span></span></a> | |
68 | with a valid program object and the parameter to be queried</p><p><a href="glGetProgramInfoLog.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramInfoLog</span></span></a> | |
69 | with a valid program object</p><p><a href="glGetUniform.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniform</span></span></a> | |
70 | with a valid program object and the location of a uniform | |
71 | variable</p><p><a href="glGetUniformLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetUniformLocation</span></span></a> | |
72 | with a valid program object and the name of a uniform | |
73 | variable</p><p><a href="glIsProgram.xml"><span class="citerefentry"><span class="refentrytitle">glIsProgram</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p><a href="glAttachShader.xml"><span class="citerefentry"><span class="refentrytitle">glAttachShader</span></span></a>, | |
74 | <a href="glBindAttribLocation.xml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>, | |
75 | <a href="glCompileShader.xml"><span class="citerefentry"><span class="refentrytitle">glCompileShader</span></span></a>, | |
76 | <a href="glCreateProgram.xml"><span class="citerefentry"><span class="refentrytitle">glCreateProgram</span></span></a>, | |
77 | <a href="glDeleteProgram.xml"><span class="citerefentry"><span class="refentrytitle">glDeleteProgram</span></span></a>, | |
78 | <a href="glDetachShader.xml"><span class="citerefentry"><span class="refentrytitle">glDetachShader</span></span></a>, | |
79 | <a href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>, | |
80 | <a href="glUniform.xml"><span class="citerefentry"><span class="refentrytitle">glUniform</span></span></a>, | |
81 | <a href="glValidateProgram.xml"><span class="citerefentry"><span class="refentrytitle">glValidateProgram</span></span></a>, | |
82 | <a href="glVertexAttrib.xml"><span class="citerefentry"><span class="refentrytitle">glVertexAttrib</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
83 | Copyright <span class="trademark"></span>© 2003-2005 3Dlabs Inc. Ltd. | |
84 | This material may be distributed subject to the terms and conditions set forth in | |
85 | the Open Publication License, v 1.0, 8 June 1999. | |
86 | <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
87 | </p></div></div></body></html> |