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="glCreateShaderProgram"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>2010</year> | |
9 | <holder>Khronos Group</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glCreateShaderProgram</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glCreateShaderProgramv</refname> | |
17 | <refpurpose>create a stand-alone program from an array of null-terminated source code strings</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>GLuint <function>glCreateShaderProgramv</function></funcdef> | |
23 | <paramdef>GLenum <parameter>type</parameter></paramdef> | |
24 | <paramdef>GLsizei <parameter>count</parameter></paramdef> | |
25 | <paramdef>const char **<parameter>strings</parameter></paramdef> | |
26 | </funcprototype> | |
27 | </funcsynopsis> | |
28 | </refsynopsisdiv> | |
29 | <refsect1 id="parameters"><title>Parameters</title> | |
30 | <variablelist> | |
31 | <varlistentry> | |
32 | <term><parameter>type</parameter></term> | |
33 | <listitem> | |
34 | <para> | |
35 | Specifies the type of shader to create. | |
36 | </para> | |
37 | </listitem> | |
38 | </varlistentry> | |
39 | <varlistentry> | |
40 | <term><parameter>count</parameter></term> | |
41 | <listitem> | |
42 | <para> | |
43 | Specifies the number of source code strings in the array <parameter>strings</parameter>. | |
44 | </para> | |
45 | </listitem> | |
46 | </varlistentry> | |
47 | <varlistentry> | |
48 | <term><parameter>strings</parameter></term> | |
49 | <listitem> | |
50 | <para> | |
51 | Specifies the address of an array of pointers to source code strings from which to create the program object. | |
52 | </para> | |
53 | </listitem> | |
54 | </varlistentry> | |
55 | </variablelist> | |
56 | </refsect1> | |
57 | <refsect1 id="description"><title>Description</title> | |
58 | <para> | |
59 | <function>glCreateShaderProgram</function> creates a program object containing compiled and linked | |
60 | shaders for a single stage specified by <parameter>type</parameter>. <parameter>strings</parameter> | |
61 | refers to an array of <parameter>count</parameter> strings from which to create the shader executables. | |
62 | </para> | |
63 | <para> | |
64 | <function>glCreateShaderProgram</function> is equivalent (assuming no errors are generated) to: | |
65 | </para> | |
66 | <programlisting><![CDATA[ const GLuint shader = glCreateShader(type); | |
67 | if (shader) { | |
68 | glShaderSource(shader, count, strings, NULL); | |
69 | glCompileShader(shader); | |
70 | const GLuint program = glCreateProgram(); | |
71 | if (program) { | |
72 | GLint compiled = GL_FALSE; | |
73 | glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); | |
74 | glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE); | |
75 | if (compiled) { | |
76 | glAttachShader(program, shader); | |
77 | glLinkProgram(program); | |
78 | glDetachShader(program, shader); | |
79 | } | |
80 | /* append-shader-info-log-to-program-info-log */ | |
81 | } | |
82 | glDeleteShader(shader); | |
83 | return program; | |
84 | } else { | |
85 | return 0; | |
86 | }]]></programlisting> | |
87 | <para> | |
88 | The program object created by <function>glCreateShaderProgram</function> has its <constant>GL_PROGRAM_SEPARABLE</constant> | |
89 | status set to <constant>GL_TRUE</constant>. | |
90 | </para> | |
91 | </refsect1> | |
92 | <refsect1 id="errors"><title>Errors</title> | |
93 | <para> | |
94 | <constant>GL_INVALID_ENUM</constant> is generated if if <parameter>type</parameter> is not | |
95 | an accepted shader type. | |
96 | </para> | |
97 | <para> | |
98 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>count</parameter> is | |
99 | negative. | |
100 | </para> | |
101 | <para> | |
102 | Other errors are generated if the supplied shader code fails to compile | |
103 | and link, as described for the commands in the pseudocode sequence above, | |
104 | but all such errors are generated without any side effects of executing those | |
105 | commands. | |
106 | </para> | |
107 | </refsect1> | |
108 | <refsect1 id="seealso"><title>See Also</title> | |
109 | <para> | |
110 | <citerefentry><refentrytitle>glCreateShader</refentrytitle></citerefentry>, | |
111 | <citerefentry><refentrytitle>glCreateProgram</refentrytitle></citerefentry>, | |
112 | <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, | |
113 | <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry> | |
114 | </para> | |
115 | </refsect1> | |
116 | <refsect1 id="Copyright"><title>Copyright</title> | |
117 | <para> | |
118 | Copyright <trademark class="copyright"></trademark> 2010-2012 Khronos Group. | |
119 | This material may be distributed subject to the terms and conditions set forth in | |
120 | the Open Publication License, v 1.0, 8 June 1999. | |
121 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
122 | </para> | |
123 | </refsect1> | |
124 | </refentry> |