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>glAttachShader</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glAttachShader"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glAttachShader — Attaches a shader object to a program object</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glAttachShader</b>(</code></td><td>GLuint </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </td><td>GLuint </td><td><var class="pdparam">shader</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 program object to which a shader | |
4 | object will be attached.</p></dd><dt><span class="term"><em class="parameter"><code>shader</code></em></span></dt><dd><p>Specifies the shader object that is to be attached.</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>In order to create an executable, there must be a way to | |
5 | specify the list of things that will be linked together. Program | |
6 | objects provide this mechanism. Shaders that are to be linked | |
7 | together in a program object must first be attached to that | |
8 | program object. <code class="function">glAttachShader</code> attaches the | |
9 | shader object specified by <em class="parameter"><code>shader</code></em> to the | |
10 | program object specified by <em class="parameter"><code>program</code></em>. This | |
11 | indicates that <em class="parameter"><code>shader</code></em> will be included in | |
12 | link operations that will be performed on | |
13 | <em class="parameter"><code>program</code></em>.</p><p>All operations that can be performed on a shader object | |
14 | are valid whether or not the shader object is attached to a | |
15 | program object. It is permissible to attach a shader object to a | |
16 | program object before source code has been loaded into the | |
17 | shader object or before the shader object has been compiled. It | |
18 | is permissible to attach multiple shader objects of the same | |
19 | type because each may contain a portion of the complete shader. | |
20 | It is also permissible to attach a shader object to more than | |
21 | one program object. If a shader object is deleted while it is | |
22 | attached to a program object, it will be flagged for deletion, | |
23 | and deletion will not occur until | |
24 | <a class="citerefentry" href="glDetachShader.xml"><span class="citerefentry"><span class="refentrytitle">glDetachShader</span></span></a> | |
25 | is called to detach it from all program objects to which it is | |
26 | attached.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p><code class="function">glAttachShader</code> | |
27 | is available only if the GL version is 2.0 or greater.</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 either | |
28 | <em class="parameter"><code>program</code></em> or <em class="parameter"><code>shader</code></em> | |
29 | is not a value generated by OpenGL.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
30 | <em class="parameter"><code>program</code></em> is not a program object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
31 | <em class="parameter"><code>shader</code></em> is not a shader object.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
32 | <em class="parameter"><code>shader</code></em> is already attached to | |
33 | <em class="parameter"><code>program</code></em>.</p><p><code class="constant">GL_INVALID_OPERATION</code> is generated if | |
34 | <code class="function">glAttachShader</code> is executed between the | |
35 | execution of | |
36 | <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> | |
37 | and the corresponding execution of | |
38 | <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="glGetAttachedShaders.xml"><span class="citerefentry"><span class="refentrytitle">glGetAttachedShaders</span></span></a> | |
39 | with the handle of a valid program object</p><p><a class="citerefentry" href="glIsProgram.xml"><span class="citerefentry"><span class="refentrytitle">glIsProgram</span></span></a></p><p><a class="citerefentry" href="glIsShader.xml"><span class="citerefentry"><span class="refentrytitle">glIsShader</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p><a class="citerefentry" href="glCompileShader.xml"><span class="citerefentry"><span class="refentrytitle">glCompileShader</span></span></a>, | |
40 | <a class="citerefentry" href="glDetachShader.xml"><span class="citerefentry"><span class="refentrytitle">glDetachShader</span></span></a>, | |
41 | <a class="citerefentry" href="glLinkProgram.xml"><span class="citerefentry"><span class="refentrytitle">glLinkProgram</span></span></a>, | |
42 | <a class="citerefentry" href="glShaderSource.xml"><span class="citerefentry"><span class="refentrytitle">glShaderSource</span></span></a></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
43 | Copyright <span class="trademark"></span>© 2003-2005 3Dlabs Inc. Ltd. | |
44 | This material may be distributed subject to the terms and conditions set forth in | |
45 | the Open Publication License, v 1.0, 8 June 1999. | |
46 | <a class="ulink" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
47 | </p></div></div></body></html> |