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="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>OpenGL copies the shader source code strings when | |
79 | <function>glShaderSource</function> is called, so an application | |
80 | may free its copy of the source code strings immediately after | |
81 | the function returns.</para> | |
82 | </refsect1> | |
83 | <refsect1 id="errors"><title>Errors</title> | |
84 | <para><constant>GL_INVALID_VALUE</constant> is generated if | |
85 | <parameter>shader</parameter> is not a value generated by | |
86 | OpenGL.</para> | |
87 | ||
88 | <para><constant>GL_INVALID_OPERATION</constant> is generated if | |
89 | <parameter>shader</parameter> is not a shader object.</para> | |
90 | ||
91 | <para><constant>GL_INVALID_VALUE</constant> is generated if | |
92 | <parameter>count</parameter> is less than 0.</para> | |
93 | ||
94 | </refsect1> | |
95 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
96 | <para><citerefentry><refentrytitle>glGetShader</refentrytitle></citerefentry> | |
97 | with arguments <parameter>shader</parameter> and | |
98 | <constant>GL_SHADER_SOURCE_LENGTH</constant></para> | |
99 | ||
100 | <para><citerefentry><refentrytitle>glGetShaderSource</refentrytitle></citerefentry> | |
101 | with argument <parameter>shader</parameter></para> | |
102 | ||
103 | <para><citerefentry><refentrytitle>glIsShader</refentrytitle></citerefentry></para> | |
104 | </refsect1> | |
105 | <refsect1 id="seealso"><title>See Also</title> | |
106 | <para><citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, | |
107 | <citerefentry><refentrytitle>glCreateShader</refentrytitle></citerefentry>, | |
108 | <citerefentry><refentrytitle>glDeleteShader</refentrytitle></citerefentry></para> | |
109 | </refsect1> | |
110 | <refsect1 id="Copyright"><title>Copyright</title> | |
111 | <para> | |
112 | Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd. | |
113 | This material may be distributed subject to the terms and conditions set forth in | |
114 | the Open Publication License, v 1.0, 8 June 1999. | |
115 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
116 | </para> | |
117 | </refsect1> | |
118 | </refentry> |