| 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 one of <constant>GL_VERTEX_SHADER</constant>, |
| 28 | <constant>GL_GEOMETRY_SHADER</constant> |
| 29 | or <constant>GL_FRAGMENT_SHADER</constant>.</para> |
| 30 | </listitem> |
| 31 | </varlistentry> |
| 32 | </variablelist> |
| 33 | </refsect1> |
| 34 | <refsect1 id="description"><title>Description</title> |
| 35 | <para><function>glCreateShader</function> creates an empty |
| 36 | shader object and returns a non-zero value by which it can be |
| 37 | referenced. A shader object is used to maintain the source code |
| 38 | strings that define a shader. <parameter>shaderType</parameter> |
| 39 | indicates the type of shader to be created. Three types of shaders |
| 40 | are supported. A shader of type |
| 41 | <constant>GL_VERTEX_SHADER</constant> is a shader that is |
| 42 | intended to run on the programmable vertex processor. A shader of type |
| 43 | <constant>GL_GEOMETRY_SHADER</constant> is a shader that is intended to |
| 44 | run on the programmable geometry processor. A shader of |
| 45 | type <constant>GL_FRAGMENT_SHADER</constant> is a shader that is |
| 46 | intended to run on the programmable fragment processor.</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>, <constant>GL_GEOMETRY_SHADER</constant> |
| 51 | or <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>Like buffer and texture objects, the name space for |
| 56 | shader objects may be shared across a set of contexts, as long |
| 57 | as the server sides of the contexts share the same address |
| 58 | space. If the name space is shared across contexts, any attached |
| 59 | objects and the data associated with those attached objects are |
| 60 | shared as well.</para> |
| 61 | |
| 62 | <para>Applications are responsible for providing the |
| 63 | synchronization across API calls when objects are accessed from |
| 64 | different execution threads.</para> |
| 65 | </refsect1> |
| 66 | <refsect1 id="errors"><title>Errors</title> |
| 67 | <para>This function returns 0 if an error occurs creating the |
| 68 | shader object.</para> |
| 69 | |
| 70 | <para><constant>GL_INVALID_ENUM</constant> is generated if |
| 71 | <parameter>shaderType</parameter> is not an accepted value.</para> |
| 72 | |
| 73 | </refsect1> |
| 74 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 75 | <para><citerefentry><refentrytitle>glGetShader</refentrytitle></citerefentry> |
| 76 | with a valid shader object and the parameter to be queried</para> |
| 77 | |
| 78 | <para><citerefentry><refentrytitle>glGetShaderInfoLog</refentrytitle></citerefentry> |
| 79 | with a valid shader object</para> |
| 80 | |
| 81 | <para><citerefentry><refentrytitle>glGetShaderSource</refentrytitle></citerefentry> |
| 82 | with a valid shader object</para> |
| 83 | |
| 84 | <para><citerefentry><refentrytitle>glIsShader</refentrytitle></citerefentry></para> |
| 85 | </refsect1> |
| 86 | <refsect1 id="seealso"><title>See Also</title> |
| 87 | <para><citerefentry><refentrytitle>glAttachShader</refentrytitle></citerefentry>, |
| 88 | <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, |
| 89 | <citerefentry><refentrytitle>glDeleteShader</refentrytitle></citerefentry>, |
| 90 | <citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry>, |
| 91 | <citerefentry><refentrytitle>glShaderSource</refentrytitle></citerefentry> |
| 92 | </para> |
| 93 | </refsect1> |
| 94 | <refsect1 id="Copyright"><title>Copyright</title> |
| 95 | <para> |
| 96 | Copyright <trademark class="copyright"></trademark> 2003-2005 3Dlabs Inc. Ltd. |
| 97 | This material may be distributed subject to the terms and conditions set forth in |
| 98 | the Open Publication License, v 1.0, 8 June 1999. |
| 99 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. |
| 100 | </para> |
| 101 | </refsect1> |
| 102 | </refentry> |