| 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="glBindTexture"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glBindTexture</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glBindTexture</refname> |
| 17 | <refpurpose>bind a named texture to a texturing target</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>void <function>glBindTexture</function></funcdef> |
| 23 | <paramdef>GLenum <parameter>target</parameter></paramdef> |
| 24 | <paramdef>GLuint <parameter>texture</parameter></paramdef> |
| 25 | </funcprototype> |
| 26 | </funcsynopsis> |
| 27 | </refsynopsisdiv> |
| 28 | <refsect1 id="parameters"><title>Parameters</title> |
| 29 | <variablelist> |
| 30 | <varlistentry> |
| 31 | <term><parameter>target</parameter></term> |
| 32 | <listitem> |
| 33 | <para> |
| 34 | Specifies the target to which the texture is bound. |
| 35 | Must be one of |
| 36 | <constant>GL_TEXTURE_1D</constant>, |
| 37 | <constant>GL_TEXTURE_2D</constant>, |
| 38 | <constant>GL_TEXTURE_3D</constant>, |
| 39 | <constant>GL_TEXTURE_1D_ARRAY</constant>, |
| 40 | <constant>GL_TEXTURE_2D_ARRAY</constant>, |
| 41 | <constant>GL_TEXTURE_RECTANGLE</constant>, |
| 42 | <constant>GL_TEXTURE_CUBE_MAP</constant>, |
| 43 | <constant>GL_TEXTURE_CUBE_MAP_ARRAY</constant>, |
| 44 | <constant>GL_TEXTURE_BUFFER</constant>, |
| 45 | <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> or |
| 46 | <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant>. |
| 47 | </para> |
| 48 | </listitem> |
| 49 | </varlistentry> |
| 50 | <varlistentry> |
| 51 | <term><parameter>texture</parameter></term> |
| 52 | <listitem> |
| 53 | <para> |
| 54 | Specifies the name of a texture. |
| 55 | </para> |
| 56 | </listitem> |
| 57 | </varlistentry> |
| 58 | </variablelist> |
| 59 | </refsect1> |
| 60 | <refsect1 id="description"><title>Description</title> |
| 61 | <para> |
| 62 | <function>glBindTexture</function> lets you create or use a named texture. Calling <function>glBindTexture</function> with |
| 63 | <parameter>target</parameter> set to |
| 64 | <constant>GL_TEXTURE_1D</constant>, |
| 65 | <constant>GL_TEXTURE_2D</constant>, |
| 66 | <constant>GL_TEXTURE_3D</constant>, |
| 67 | <constant>GL_TEXTURE_1D_ARRAY</constant>, |
| 68 | <constant>GL_TEXTURE_2D_ARRAY</constant>, |
| 69 | <constant>GL_TEXTURE_RECTANGLE</constant>, |
| 70 | <constant>GL_TEXTURE_CUBE_MAP</constant>, |
| 71 | <constant>GL_TEXTURE_CUBE_MAP_ARRAY</constant>, |
| 72 | <constant>GL_TEXTURE_BUFFER</constant>, |
| 73 | <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> or |
| 74 | <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant> |
| 75 | and <parameter>texture</parameter> set to the name of the new texture binds the texture name to the target. |
| 76 | When a texture is bound to a target, the previous binding for that target is automatically broken. |
| 77 | </para> |
| 78 | <para> |
| 79 | Texture names are unsigned integers. The value zero is reserved to |
| 80 | represent the default texture for each texture target. |
| 81 | Texture names and the corresponding texture contents are local to |
| 82 | the shared object space of the current GL rendering context; |
| 83 | two rendering contexts share texture names only if they |
| 84 | explicitly enable sharing between contexts through the appropriate GL windows interfaces functions. |
| 85 | </para> |
| 86 | <para> |
| 87 | You must use <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry> to generate a set of new texture names. |
| 88 | </para> |
| 89 | <para> |
| 90 | When a texture is first bound, it assumes the specified target: |
| 91 | A texture first bound to <constant>GL_TEXTURE_1D</constant> becomes one-dimensional texture, a |
| 92 | texture first bound to <constant>GL_TEXTURE_2D</constant> becomes two-dimensional texture, a |
| 93 | texture first bound to <constant>GL_TEXTURE_3D</constant> becomes three-dimensional texture, a |
| 94 | texture first bound to <constant>GL_TEXTURE_1D_ARRAY</constant> becomes one-dimensional array texture, a |
| 95 | texture first bound to <constant>GL_TEXTURE_2D_ARRAY</constant> becomes two-dimensional arary texture, a |
| 96 | texture first bound to <constant>GL_TEXTURE_RECTANGLE</constant> becomes rectangle texture, a |
| 97 | texture first bound to <constant>GL_TEXTURE_CUBE_MAP</constant> becomes a cube-mapped texture, a |
| 98 | texture first bound to <constant>GL_TEXTURE_CUBE_MAP_ARRAY</constant> becomes a cube-mapped array texture, a |
| 99 | texture first bound to <constant>GL_TEXTURE_BUFFER</constant> becomes a buffer texture, a |
| 100 | texture first bound to <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> becomes a two-dimensional multisampled texture, and a |
| 101 | texture first bound to <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant> becomes a two-dimensional multisampled array texture. |
| 102 | The state of a one-dimensional texture immediately after it is first bound is equivalent to the state of the |
| 103 | default <constant>GL_TEXTURE_1D</constant> at GL initialization, and similarly for the other texture types. |
| 104 | </para> |
| 105 | <para> |
| 106 | While a texture is bound, GL operations on the target to which it is |
| 107 | bound affect the bound texture, and queries of the target to which it |
| 108 | is bound return state from the bound texture. |
| 109 | In effect, the texture targets become aliases for the textures currently |
| 110 | bound to them, and the texture name zero refers to the default textures |
| 111 | that were bound to them at initialization. |
| 112 | </para> |
| 113 | <para> |
| 114 | A texture binding created with <function>glBindTexture</function> remains active until a different |
| 115 | texture is bound to the same target, or until the bound texture is |
| 116 | deleted with <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>. |
| 117 | </para> |
| 118 | <para> |
| 119 | Once created, a named texture may be re-bound to its same original target as often as needed. |
| 120 | It is usually much faster to use <function>glBindTexture</function> to bind an existing named |
| 121 | texture to one of the texture targets than it is to reload the texture image |
| 122 | using <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, |
| 123 | <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry> or another similar function. |
| 124 | </para> |
| 125 | </refsect1> |
| 126 | <refsect1 id="notes"><title>Notes</title> |
| 127 | <para> |
| 128 | The <constant>GL_TEXTURE_2D_MULTISAMPLE</constant> and <constant>GL_TEXTURE_2D_MULTISAMPLE_ARRAY</constant> targets are available |
| 129 | only if the GL version is 3.2 or higher. |
| 130 | </para> |
| 131 | </refsect1> |
| 132 | <refsect1 id="errors"><title>Errors</title> |
| 133 | <para> |
| 134 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable |
| 135 | values. |
| 136 | </para> |
| 137 | <para> |
| 138 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is not a name returned from |
| 139 | a previous call to <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>. |
| 140 | </para> |
| 141 | <para> |
| 142 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>texture</parameter> was previously created with a target |
| 143 | that doesn't match that of <parameter>target</parameter>. |
| 144 | </para> |
| 145 | </refsect1> |
| 146 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 147 | <para> |
| 148 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_BINDING_1D</constant>, |
| 149 | <constant>GL_TEXTURE_BINDING_2D</constant>, <constant>GL_TEXTURE_BINDING_3D</constant>, <constant>GL_TEXTURE_BINDING_1D_ARRAY</constant>, |
| 150 | <constant>GL_TEXTURE_BINDING_2D_ARRAY</constant>, <constant>GL_TEXTURE_BINDING_RECTANGLE</constant>, |
| 151 | <constant>GL_TEXTURE_BINDING_BUFFER</constant>, <constant>GL_TEXTURE_BINDING_CUBE_MAP</constant>, <constant>GL_TEXTURE_BINDING_CUBE_MAP</constant>, |
| 152 | <constant>GL_TEXTURE_BINDING_CUBE_MAP_ARRAY</constant>, |
| 153 | <constant>GL_TEXTURE_BINDING_2D_MULTISAMPLE</constant>, |
| 154 | or <constant>GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY</constant>. |
| 155 | </para> |
| 156 | </refsect1> |
| 157 | <refsect1 id="seealso"><title>See Also</title> |
| 158 | <para> |
| 159 | <citerefentry><refentrytitle>glDeleteTextures</refentrytitle></citerefentry>, |
| 160 | <citerefentry><refentrytitle>glGenTextures</refentrytitle></citerefentry>, |
| 161 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>, |
| 162 | <citerefentry><refentrytitle>glGetTexParameter</refentrytitle></citerefentry>, |
| 163 | <citerefentry><refentrytitle>glIsTexture</refentrytitle></citerefentry>, |
| 164 | <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, |
| 165 | <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, |
| 166 | <citerefentry><refentrytitle>glTexImage2DMultisample</refentrytitle></citerefentry>, |
| 167 | <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>, |
| 168 | <citerefentry><refentrytitle>glTexImage3DMultisample</refentrytitle></citerefentry>, |
| 169 | <citerefentry><refentrytitle>glTexBuffer</refentrytitle></citerefentry>, |
| 170 | <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> |
| 171 | </para> |
| 172 | </refsect1> |
| 173 | <refsect1 id="Copyright"><title>Copyright</title> |
| 174 | <para> |
| 175 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 176 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 177 | Free Software B License. For details, see |
| 178 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 179 | </para> |
| 180 | </refsect1> |
| 181 | </refentry> |