| 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="glCreateProgram"> |
| 5 | <refmeta> |
| 6 | <refentrytitle>glCreateProgram</refentrytitle> |
| 7 | <manvolnum>3G</manvolnum> |
| 8 | </refmeta> |
| 9 | <refnamediv> |
| 10 | <refname>glCreateProgram</refname> |
| 11 | <refpurpose>Creates a program object</refpurpose> |
| 12 | </refnamediv> |
| 13 | <refsynopsisdiv><title>C Specification</title> |
| 14 | <funcsynopsis> |
| 15 | <funcprototype> |
| 16 | <funcdef>GLuint <function>glCreateProgram</function></funcdef> |
| 17 | <paramdef><parameter>void</parameter></paramdef> |
| 18 | </funcprototype> |
| 19 | </funcsynopsis> |
| 20 | </refsynopsisdiv> |
| 21 | <refsect1 id="description"><title>Description</title> |
| 22 | <para><function>glCreateProgram</function> creates an empty |
| 23 | program object and returns a non-zero value by which it can be |
| 24 | referenced. A program object is an object to which shader |
| 25 | objects can be attached. This provides a mechanism to specify |
| 26 | the shader objects that will be linked to create a program. It |
| 27 | also provides a means for checking the compatibility of the |
| 28 | shaders that will be used to create a program (for instance, |
| 29 | checking the compatibility between a vertex shader and a |
| 30 | fragment shader). When no longer needed as part of a program |
| 31 | object, shader objects can be detached.</para> |
| 32 | |
| 33 | <para>One or more executables are created in a program object by |
| 34 | successfully attaching shader objects to it with |
| 35 | <citerefentry><refentrytitle>glAttachShader</refentrytitle></citerefentry>, |
| 36 | successfully compiling the shader objects with |
| 37 | <citerefentry><refentrytitle>glCompileShader</refentrytitle></citerefentry>, |
| 38 | and successfully linking the program object with |
| 39 | <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>. |
| 40 | These executables are made part of current state when |
| 41 | <citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry> |
| 42 | is called. Program objects can be deleted by calling |
| 43 | <citerefentry><refentrytitle>glDeleteProgram</refentrytitle></citerefentry>. |
| 44 | The memory associated with the program object will be deleted |
| 45 | when it is no longer part of current rendering state for any |
| 46 | context.</para> |
| 47 | </refsect1> |
| 48 | <refsect1 id="notes"><title>Notes</title> |
| 49 | <para><function>glCreateProgram</function> is available only if |
| 50 | the GL version is 2.0 or greater.</para> |
| 51 | |
| 52 | <para>Like display lists and texture objects, the name space for |
| 53 | program objects may be shared across a set of contexts, as long |
| 54 | as the server sides of the contexts share the same address |
| 55 | space. If the name space is shared across contexts, any attached |
| 56 | objects and the data associated with those attached objects are |
| 57 | shared as well.</para> |
| 58 | |
| 59 | <para>Applications are responsible for providing the |
| 60 | synchronization across API calls when objects are accessed from |
| 61 | different execution threads.</para> |
| 62 | </refsect1> |
| 63 | <refsect1 id="errors"><title>Errors</title> |
| 64 | <para>This function returns 0 if an error occurs creating the program object.</para> |
| 65 | |
| 66 | <para><constant>GL_INVALID_OPERATION</constant> is generated if |
| 67 | <function>glCreateProgram</function> is executed between the |
| 68 | execution of |
| 69 | <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> |
| 70 | and the corresponding execution of |
| 71 | <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.</para> |
| 72 | </refsect1> |
| 73 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 74 | <para><citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> |
| 75 | with the argument <constant>GL_CURRENT_PROGRAM</constant></para> |
| 76 | |
| 77 | <para><citerefentry><refentrytitle>glGetActiveAttrib</refentrytitle></citerefentry> |
| 78 | with a valid program object and the index of an active attribute |
| 79 | variable</para> |
| 80 | |
| 81 | <para><citerefentry><refentrytitle>glGetActiveUniform</refentrytitle></citerefentry> |
| 82 | with a valid program object and the index of an active uniform |
| 83 | variable</para> |
| 84 | |
| 85 | <para><citerefentry><refentrytitle>glGetAttachedShaders</refentrytitle></citerefentry> |
| 86 | with a valid program object</para> |
| 87 | |
| 88 | <para><citerefentry><refentrytitle>glGetAttribLocation</refentrytitle></citerefentry> |
| 89 | with a valid program object and the name of an attribute |
| 90 | variable</para> |
| 91 | |
| 92 | <para><citerefentry><refentrytitle>glGetProgram</refentrytitle></citerefentry> |
| 93 | with a valid program object and the parameter to be queried</para> |
| 94 | |
| 95 | <para><citerefentry><refentrytitle>glGetProgramInfoLog</refentrytitle></citerefentry> |
| 96 | with a valid program object</para> |
| 97 | |
| 98 | <para><citerefentry><refentrytitle>glGetUniform</refentrytitle></citerefentry> |
| 99 | with a valid program object and the location of a uniform |
| 100 | variable</para> |
| 101 | |
| 102 | <para><citerefentry><refentrytitle>glGetUniformLocation</refentrytitle></citerefentry> |
| 103 | with a valid program object and the name of a uniform |
| 104 | variable</para> |
| 105 | |
| 106 | <para><citerefentry><refentrytitle>glIsProgram</refentrytitle></citerefentry></para> |
| 107 | </refsect1> |
| 108 | <refsect1 id="seealso"><title>See Also</title> |
| 109 | <para><citerefentry><refentrytitle>glAttachShader</refentrytitle></citerefentry>, |
| 110 | <citerefentry><refentrytitle>glBindAttribLocation</refentrytitle></citerefentry>, |
| 111 | <citerefentry><refentrytitle>glCreateShader</refentrytitle></citerefentry>, |
| 112 | <citerefentry><refentrytitle>glDeleteProgram</refentrytitle></citerefentry>, |
| 113 | <citerefentry><refentrytitle>glDetachShader</refentrytitle></citerefentry>, |
| 114 | <citerefentry><refentrytitle>glLinkProgram</refentrytitle></citerefentry>, |
| 115 | <citerefentry><refentrytitle>glUniform</refentrytitle></citerefentry>, |
| 116 | <citerefentry><refentrytitle>glUseProgram</refentrytitle></citerefentry>, |
| 117 | <citerefentry><refentrytitle>glValidateProgram</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> |