Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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="glAttachShader"> | |
5 | <refmeta> | |
6 | <refentrytitle>glAttachShader</refentrytitle> | |
7 | <manvolnum>3G</manvolnum> | |
8 | </refmeta> | |
9 | <refnamediv> | |
10 | <refname>glAttachShader</refname> | |
11 | <refpurpose>Attaches a shader object to a program object</refpurpose> | |
12 | </refnamediv> | |
13 | <refsynopsisdiv><title>C Specification</title> | |
14 | <funcsynopsis> | |
15 | <funcprototype> | |
16 | <funcdef>void <function>glAttachShader</function></funcdef> | |
17 | <paramdef>GLuint <parameter>program</parameter></paramdef> | |
18 | <paramdef>GLuint <parameter>shader</parameter></paramdef> | |
19 | </funcprototype> | |
20 | </funcsynopsis> | |
21 | </refsynopsisdiv> | |
22 | <refsect1 id="parameters"><title>Parameters</title> | |
23 | <variablelist> | |
24 | <varlistentry> | |
25 | <term><parameter>program</parameter></term> | |
26 | <listitem> | |
27 | <para>Specifies the program object to which a shader | |
28 | object will be attached.</para> | |
29 | </listitem> | |
30 | ||
31 | </varlistentry> | |
32 | <varlistentry> | |
33 | <term><parameter>shader</parameter></term> | |
34 | <listitem> | |
35 | <para>Specifies the shader object that is to be attached.</para> | |
36 | </listitem> | |
37 | </varlistentry> | |
38 | </variablelist> | |
39 | </refsect1> | |
40 | <refsect1 id="description"><title>Description</title> | |
41 | <para>In order to create a complete shader program, there must be a way to | |
42 | specify the list of things that will be linked together. Program | |
43 | objects provide this mechanism. Shaders that are to be linked | |
44 | together in a program object must first be attached to that | |
45 | program object. <function>glAttachShader</function> attaches the | |
46 | shader object specified by <parameter>shader</parameter> to the | |
47 | program object specified by <parameter>program</parameter>. This | |
48 | indicates that <parameter>shader</parameter> will be included in | |
49 | link operations that will be performed on | |
50 | <parameter>program</parameter>.</para> | |
51 | ||
52 | <para>All operations that can be performed on a shader object | |
53 | are valid whether or not the shader object is attached to a | |
54 | program object. It is permissible to attach a shader object to a | |
55 | program object before source code has been loaded into the | |
56 | shader object or before the shader object has been compiled. It | |
57 | is permissible to attach multiple shader objects of the same | |
58 | type because each may contain a portion of the complete shader. | |
59 | It is also permissible to attach a shader object to more than | |
60 | one program object. If a shader object is deleted while it is | |
61 | attached to a program object, it will be flagged for deletion, | |
62 | and deletion will not occur until | |
63 | <citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry> | |
64 | is called to detach it from all program objects to which it is | |
65 | attached.</para> | |
66 | </refsect1> | |
67 | <refsect1 id="errors"><title>Errors</title> | |
68 | <para><constant>GL_INVALID_VALUE</constant> is generated if either | |
69 | <parameter>program</parameter> or <parameter>shader</parameter> | |
70 | is not a value generated by OpenGL.</para> | |
71 | ||
72 | <para><constant>GL_INVALID_OPERATION</constant> is generated if | |
73 | <parameter>program</parameter> is not a program object.</para> | |
74 | ||
75 | <para><constant>GL_INVALID_OPERATION</constant> is generated if | |
76 | <parameter>shader</parameter> is not a shader object.</para> | |
77 | ||
78 | <para><constant>GL_INVALID_OPERATION</constant> is generated if | |
79 | <parameter>shader</parameter> is already attached to | |
80 | <parameter>program</parameter>.</para> | |
81 | ||
82 | </refsect1> | |
83 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
84 | <para> | |
85 | <citerefentry><refentrytitle>glGetAttachedShaders</refentrytitle></citerefentry> | |
86 | with the handle of a valid program object | |
87 | </para> | |
88 | <para> | |
89 | <citerefentry><refentrytitle>glGetShaderInfoLog</refentrytitle></citerefentry> | |
90 | </para> | |
91 | <para> | |
92 | <citerefentry><refentrytitle>glGetShaderSource</refentrytitle></citerefentry> | |
93 | </para> | |
94 | <para> | |
95 | <citerefentry><refentrytitle>glIsProgram</refentrytitle></citerefentry> | |
96 | </para> | |
97 | <para> | |
98 | <citerefentry><refentrytitle>glIsShader</refentrytitle></citerefentry> | |
99 | </para> | |
100 | </refsect1> | |
101 | <refsect1 id="seealso"><title>See Also</title> | |
102 | <para> | |
103 | <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, | |
104 | <citerefentry><refentrytitle>glCreateShader</refentrytitle></citerefentry>, | |
105 | <citerefentry><refentrytitle>glDeleteShader</refentrytitle></citerefentry>, | |
106 | <citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry>, | |
107 | <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>, | |
108 | <citerefentry><refentrytitle>glShaderSource</refentrytitle></citerefentry> | |
109 | </para> | |
110 | </refsect1> | |
111 | <refsect1 id="Copyright"><title>Copyright</title> | |
112 | <para> | |
113 | Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd. | |
114 | This material may be distributed subject to the terms and conditions set forth in | |
115 | the Open Publication License, v 1.0, 8 June 1999. | |
116 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
117 | </para> | |
118 | </refsect1> | |
119 | </refentry> |