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="glCreateShader"> | |
5 | <refmeta> | |
6 | <refentrytitle>glCreateShader</refentrytitle> | |
7 | <manvolnum>3G</manvolnum> | |
8 | </refmeta> | |
9 | <refnamediv> | |
10 | <refname>glCreateShader</refname> | |
11 | <refpurpose>Creates a shader object</refpurpose> | |
12 | </refnamediv> | |
13 | <refsynopsisdiv><title>C Specification</title> | |
14 | <funcsynopsis> | |
15 | <funcprototype> | |
16 | <funcdef>GLuint <function>glCreateShader</function></funcdef> | |
17 | <paramdef>GLenum <parameter>shaderType</parameter></paramdef> | |
18 | </funcprototype> | |
19 | </funcsynopsis> | |
20 | </refsynopsisdiv> | |
21 | <refsect1 id="parameters"><title>Parameters</title> | |
22 | <variablelist> | |
23 | <varlistentry> | |
24 | <term><parameter>shaderType</parameter></term> | |
25 | <listitem> | |
26 | <para>Specifies the type of shader to be created. | |
27 | Must be either <constant>GL_VERTEX_SHADER</constant> | |
28 | or <constant>GL_FRAGMENT_SHADER</constant>.</para> | |
29 | </listitem> | |
30 | </varlistentry> | |
31 | </variablelist> | |
32 | </refsect1> | |
33 | <refsect1 id="description"><title>Description</title> | |
34 | <para><function>glCreateShader</function> creates an empty | |
35 | shader object and returns a non-zero value by which it can be | |
36 | referenced. A shader object is used to maintain the source code | |
37 | strings that define a shader. <parameter>shaderType</parameter> | |
38 | indicates the type of shader to be created. Two types of shaders | |
39 | are supported. A shader of type | |
40 | <constant>GL_VERTEX_SHADER</constant> is a shader that is | |
41 | intended to run on the programmable vertex processor and replace | |
42 | the fixed functionality vertex processing in OpenGL. A shader of | |
43 | type <constant>GL_FRAGMENT_SHADER</constant> is a shader that is | |
44 | intended to run on the programmable fragment processor and | |
45 | replace the fixed functionality fragment processing in | |
46 | OpenGL.</para> | |
47 | ||
48 | <para>When created, a shader object's | |
49 | <constant>GL_SHADER_TYPE</constant> parameter is set to either | |
50 | <constant>GL_VERTEX_SHADER</constant> or | |
51 | <constant>GL_FRAGMENT_SHADER</constant>, depending on the value | |
52 | of <parameter>shaderType</parameter>.</para> | |
53 | </refsect1> | |
54 | <refsect1 id="notes"><title>Notes</title> | |
55 | <para><function>glCreateShader</function> is available only if | |
56 | the GL version is 2.0 or greater.</para> | |
57 | ||
58 | <para>Like display lists and texture objects, the name space for | |
59 | shader objects may be shared across a set of contexts, as long | |
60 | as the server sides of the contexts share the same address | |
61 | space. If the name space is shared across contexts, any attached | |
62 | objects and the data associated with those attached objects are | |
63 | shared as well.</para> | |
64 | ||
65 | <para>Applications are responsible for providing the | |
66 | synchronization across API calls when objects are accessed from | |
67 | different execution threads.</para> | |
68 | </refsect1> | |
69 | <refsect1 id="errors"><title>Errors</title> | |
70 | <para>This function returns 0 if an error occurs creating the | |
71 | shader object.</para> | |
72 | ||
73 | <para><constant>GL_INVALID_ENUM</constant> is generated if | |
74 | <parameter>shaderType</parameter> is not an accepted value.</para> | |
75 | ||
76 | <para><constant>GL_INVALID_OPERATION</constant> is generated if | |
77 | <function>glCreateShader</function> is executed between the | |
78 | execution of | |
79 | <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> | |
80 | and the corresponding execution of | |
81 | <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.</para> | |
82 | </refsect1> | |
83 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
84 | <para><citerefentry><refentrytitle>glGetShader</refentrytitle></citerefentry> | |
85 | with a valid shader object and the parameter to be queried</para> | |
86 | ||
87 | <para><citerefentry><refentrytitle>glGetShaderInfoLog</refentrytitle></citerefentry> | |
88 | with a valid shader object</para> | |
89 | ||
90 | <para><citerefentry><refentrytitle>glGetShaderSource</refentrytitle></citerefentry> | |
91 | with a valid shader object</para> | |
92 | ||
93 | <para><citerefentry><refentrytitle>glIsShader</refentrytitle></citerefentry></para> | |
94 | </refsect1> | |
95 | <refsect1 id="seealso"><title>See Also</title> | |
96 | <para><citerefentry><refentrytitle>glAttachShader</refentrytitle></citerefentry>, | |
97 | <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, | |
98 | <citerefentry><refentrytitle>glDeleteShader</refentrytitle></citerefentry>, | |
99 | <citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry>, | |
100 | <citerefentry><refentrytitle>glShaderSource</refentrytitle></citerefentry> | |
101 | </para> | |
102 | </refsect1> | |
103 | <refsect1 id="Copyright"><title>Copyright</title> | |
104 | <para> | |
105 | Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd. | |
106 | This material may be distributed subject to the terms and conditions set forth in | |
107 | the Open Publication License, v 1.0, 8 June 1999. | |
108 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
109 | </para> | |
110 | </refsect1> | |
111 | </refentry> |