740d3c9b9f5da270865109a06606fbe87261b80f
[clinton/guile-figl.git] / upstream-man-pages / man2 / glShaderSource.xml
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="glShaderSource">
5 <refmeta>
6 <refentrytitle>glShaderSource</refentrytitle>
7 <manvolnum>3G</manvolnum>
8 </refmeta>
9 <refnamediv>
10 <refname>glShaderSource</refname>
11 <refpurpose>Replaces the source code in a shader object</refpurpose>
12 </refnamediv>
13 <refsynopsisdiv><title>C Specification</title>
14 <funcsynopsis>
15 <funcprototype>
16 <funcdef>void <function>glShaderSource</function></funcdef>
17 <paramdef>GLuint <parameter>shader</parameter></paramdef>
18 <paramdef>GLsizei <parameter>count</parameter></paramdef>
19 <paramdef>const GLchar **<parameter>string</parameter></paramdef>
20 <paramdef>const GLint *<parameter>length</parameter></paramdef>
21 </funcprototype>
22 </funcsynopsis>
23 </refsynopsisdiv>
24 <refsect1 id="parameters"><title>Parameters</title>
25 <variablelist>
26 <varlistentry>
27 <term><parameter>shader</parameter></term>
28 <listitem>
29 <para>Specifies the handle of the shader object
30 whose source code is to be replaced.</para>
31 </listitem>
32 </varlistentry>
33 <varlistentry>
34 <term><parameter>count</parameter></term>
35 <listitem>
36 <para>Specifies the number of elements in the
37 <parameter>string</parameter> and
38 <parameter>length</parameter>
39 arrays.</para>
40 </listitem>
41 </varlistentry>
42 <varlistentry>
43 <term><parameter>string</parameter></term>
44 <listitem>
45 <para>Specifies an array of pointers to strings
46 containing the source code to be loaded into the
47 shader.</para>
48 </listitem>
49 </varlistentry>
50 <varlistentry>
51 <term><parameter>length</parameter></term>
52 <listitem>
53 <para>Specifies an array of string lengths.</para>
54 </listitem>
55 </varlistentry>
56 </variablelist>
57 </refsect1>
58 <refsect1 id="description"><title>Description</title>
59 <para><function>glShaderSource</function> sets the source code
60 in <parameter>shader</parameter> to the source code in the array
61 of strings specified by <parameter>string</parameter>. Any
62 source code previously stored in the shader object is completely
63 replaced. The number of strings in the array is specified by
64 <parameter>count</parameter>. If <parameter>length</parameter>
65 is <constant>NULL</constant>, each string is assumed to be null
66 terminated. If <parameter>length</parameter> is a value other
67 than <constant>NULL</constant>, it points to an array containing
68 a string length for each of the corresponding elements of
69 <parameter>string</parameter>. Each element in the
70 <parameter>length</parameter> array may contain the length of
71 the corresponding string (the null character is not counted as
72 part of the string length) or a value less than 0 to indicate
73 that the string is null terminated. The source code strings are
74 not scanned or parsed at this time; they are simply copied into
75 the specified shader object.</para>
76 </refsect1>
77 <refsect1 id="notes"><title>Notes</title>
78 <para><function>glShaderSource</function> is available only if
79 the GL version is 2.0 or greater.</para>
80
81 <para>OpenGL copies the shader source code strings when
82 <function>glShaderSource</function> is called, so an application
83 may free its copy of the source code strings immediately after
84 the function returns.</para>
85 </refsect1>
86 <refsect1 id="errors"><title>Errors</title>
87 <para><constant>GL_INVALID_VALUE</constant> is generated if
88 <parameter>shader</parameter> is not a value generated by
89 OpenGL.</para>
90
91 <para><constant>GL_INVALID_OPERATION</constant> is generated if
92 <parameter>shader</parameter> is not a shader object.</para>
93
94 <para><constant>GL_INVALID_VALUE</constant> is generated if
95 <parameter>count</parameter> is less than 0.</para>
96
97 <para><constant>GL_INVALID_OPERATION</constant> is generated if
98 <function>glShaderSource</function> is executed between the
99 execution of
100 <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
101 and the corresponding execution of
102 <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.</para>
103 </refsect1>
104 <refsect1 id="associatedgets"><title>Associated Gets</title>
105 <para><citerefentry><refentrytitle>glGetShader</refentrytitle></citerefentry>
106 with arguments <parameter>shader</parameter> and
107 <constant>GL_SHADER_SOURCE_LENGTH</constant></para>
108
109 <para><citerefentry><refentrytitle>glGetShaderSource</refentrytitle></citerefentry>
110 with argument <parameter>shader</parameter></para>
111
112 <para><citerefentry><refentrytitle>glIsShader</refentrytitle></citerefentry></para>
113 </refsect1>
114 <refsect1 id="seealso"><title>See Also</title>
115 <para><citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>,
116 <citerefentry><refentrytitle>glCreateShader</refentrytitle></citerefentry>,
117 <citerefentry><refentrytitle>glDeleteShader</refentrytitle></citerefentry></para>
118 </refsect1>
119 <refsect1 id="Copyright"><title>Copyright</title>
120 <para>
121 Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd.
122 This material may be distributed subject to the terms and conditions set forth in
123 the Open Publication License, v 1.0, 8 June 1999.
124 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
125 </para>
126 </refsect1>
127 </refentry>