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=
"glCompressedTexImage2D">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glCompressedTexImage2D
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glCompressedTexImage2D
</refname>
17 <refpurpose>specify a two-dimensional texture image in a compressed format
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glCompressedTexImage2D
</function></funcdef>
23 <paramdef>GLenum
<parameter>target
</parameter></paramdef>
24 <paramdef>GLint
<parameter>level
</parameter></paramdef>
25 <paramdef>GLenum
<parameter>internalformat
</parameter></paramdef>
26 <paramdef>GLsizei
<parameter>width
</parameter></paramdef>
27 <paramdef>GLsizei
<parameter>height
</parameter></paramdef>
28 <paramdef>GLint
<parameter>border
</parameter></paramdef>
29 <paramdef>GLsizei
<parameter>imageSize
</parameter></paramdef>
30 <paramdef>const GLvoid *
<parameter>data
</parameter></paramdef>
34 <!-- eqn: ignoring delim $$ -->
35 <refsect1 id=
"parameters"><title>Parameters
</title>
38 <term><parameter>target
</parameter></term>
41 Specifies the target texture.
42 Must be
<constant>GL_TEXTURE_2D
</constant>,
<constant>GL_PROXY_TEXTURE_2D
</constant>,
43 <constant>GL_TEXTURE_1D_ARRAY
</constant>,
<constant>GL_PROXY_TEXTURE_1D_ARRAY
</constant>,
44 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X
</constant>,
45 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X
</constant>,
46 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y
</constant>,
47 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
</constant>,
48 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z
</constant>,
49 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
</constant>, or
50 <constant>GL_PROXY_TEXTURE_CUBE_MAP
</constant>.
55 <term><parameter>level
</parameter></term>
58 Specifies the level-of-detail number.
59 Level
0 is the base image level.
60 Level
<emphasis>n
</emphasis> is the
<emphasis>n
</emphasis>th mipmap reduction image.
65 <term><parameter>internalformat
</parameter></term>
68 Specifies the format of the compressed image data stored at address
<parameter>data
</parameter>.
73 <term><parameter>width
</parameter></term>
76 Specifies the width of the texture image.
77 All implementations support
2D texture images that are at least
64 texels
78 wide and cube-mapped texture images that are at least
16 texels wide.
83 <term><parameter>height
</parameter></term>
86 Specifies the height of the texture image.
87 All implementations support
2D texture images that are at least
64 texels
88 high and cube-mapped texture images that are at least
16 texels high.
93 <term><parameter>border
</parameter></term>
101 <term><parameter>imageSize
</parameter></term>
104 Specifies the number of unsigned bytes of image data starting at the
105 address specified by
<parameter>data
</parameter>.
110 <term><parameter>data
</parameter></term>
113 Specifies a pointer to the compressed image data in memory.
119 <refsect1 id=
"description"><title>Description
</title>
121 Texturing allows elements of an image array to be read by shaders.
124 <function>glCompressedTexImage2D
</function> loads a previously defined, and retrieved, compressed two-dimensional
125 texture image if
<parameter>target
</parameter> is
<constant>GL_TEXTURE_2D
</constant>, or one of the
126 cube map faces such as
<constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X
</constant>.
127 (see
<citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry>).
130 If
<parameter>target
</parameter> is
<constant>GL_TEXTURE_1D_ARRAY
</constant>,
<parameter>data
</parameter>
131 is treated as an array of compressed
1D textures.
134 If
<parameter>target
</parameter> is
<constant>GL_PROXY_TEXTURE_2D
</constant>,
<constant>GL_PROXY_TEXTURE_1D_ARRAY
</constant>
135 or
<constant>GL_PROXY_CUBE_MAP
</constant>, no data is read from
<parameter>data
</parameter>, but
136 all of the texture image state is recalculated, checked for consistency,
137 and checked against the implementation's capabilities. If the
138 implementation cannot handle a texture of the requested texture size, it
139 sets all of the image state to
0, but does not generate an error (see
140 <citerefentry><refentrytitle>glGetError
</refentrytitle></citerefentry>). To query for an entire mipmap array,
141 use an image array level greater than or equal to
1.
144 <parameter>internalformat
</parameter> must be a known compressed image format (such as
<constant>GL_RGTC
</constant>)
145 or an extension-specified compressed-texture format.
146 When a texture is loaded with
<citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry> using a generic compressed
147 texture format (e.g.,
<constant>GL_COMPRESSED_RGB
</constant>), the GL selects from one of
148 its extensions supporting compressed textures. In order to load the
149 compressed texture image using
<function>glCompressedTexImage2D
</function>, query the compressed texture image's
150 size and format using
<citerefentry><refentrytitle>glGetTexLevelParameter
</refentrytitle></citerefentry>.
153 If a non-zero named buffer object is bound to the
<constant>GL_PIXEL_UNPACK_BUFFER
</constant> target
154 (see
<citerefentry><refentrytitle>glBindBuffer
</refentrytitle></citerefentry>) while a texture image is
155 specified,
<parameter>data
</parameter> is treated as a byte offset into the buffer object's data store.
158 <refsect1 id=
"errors"><title>Errors
</title>
160 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>internalformat
</parameter> is not one of the generic
161 compressed internal formats:
162 <constant>GL_COMPRESSED_RED
</constant>,
163 <constant>GL_COMPRESSED_RG
</constant>,
164 <constant>GL_COMPRESSED_RGB
</constant>,
165 <constant>GL_COMPRESSED_RGBA
</constant>.
166 <constant>GL_COMPRESSED_SRGB
</constant>, or
167 <constant>GL_COMPRESSED_SRGB_ALPHA
</constant>.
170 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>imageSize
</parameter> is not consistent with
171 the format, dimensions, and contents of the specified compressed image
175 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>border
</parameter> is not
0.
178 <constant>GL_INVALID_OPERATION
</constant> is generated if parameter combinations are not
179 supported by the specific compressed internal format as specified in the
180 specific texture compression extension.
183 <constant>GL_INVALID_OPERATION
</constant> is generated if a non-zero buffer object name is bound to the
184 <constant>GL_PIXEL_UNPACK_BUFFER
</constant> target and the buffer object's data store is currently mapped.
187 <constant>GL_INVALID_OPERATION
</constant> is generated if a non-zero buffer object name is bound to the
188 <constant>GL_PIXEL_UNPACK_BUFFER
</constant> target and the data would be unpacked from the buffer
189 object such that the memory reads required would exceed the data store size.
192 Undefined results, including abnormal program termination, are generated if
193 <parameter>data
</parameter> is not encoded in a manner consistent with the extension
194 specification defining the internal compression format.
197 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
199 <citerefentry><refentrytitle>glGetCompressedTexImage
</refentrytitle></citerefentry>
202 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_TEXTURE_COMPRESSED
</constant>
205 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_PIXEL_UNPACK_BUFFER_BINDING
</constant>
208 <citerefentry><refentrytitle>glGetTexLevelParameter
</refentrytitle></citerefentry> with arguments
<constant>GL_TEXTURE_INTERNAL_FORMAT
</constant>
209 and
<constant>GL_TEXTURE_COMPRESSED_IMAGE_SIZE
</constant>
212 <refsect1 id=
"seealso"><title>See Also
</title>
214 <citerefentry><refentrytitle>glActiveTexture
</refentrytitle></citerefentry>,
215 <citerefentry><refentrytitle>glCompressedTexImage1D
</refentrytitle></citerefentry>,
216 <citerefentry><refentrytitle>glCompressedTexImage3D
</refentrytitle></citerefentry>,
217 <citerefentry><refentrytitle>glCompressedTexSubImage1D
</refentrytitle></citerefentry>,
218 <citerefentry><refentrytitle>glCompressedTexSubImage2D
</refentrytitle></citerefentry>,
219 <citerefentry><refentrytitle>glCompressedTexSubImage3D
</refentrytitle></citerefentry>,
220 <citerefentry><refentrytitle>glCopyTexImage1D
</refentrytitle></citerefentry>,
221 <citerefentry><refentrytitle>glCopyTexSubImage1D
</refentrytitle></citerefentry>,
222 <citerefentry><refentrytitle>glCopyTexSubImage2D
</refentrytitle></citerefentry>,
223 <citerefentry><refentrytitle>glCopyTexSubImage3D
</refentrytitle></citerefentry>,
224 <citerefentry><refentrytitle>glPixelStore
</refentrytitle></citerefentry>,
225 <citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry>,
226 <citerefentry><refentrytitle>glTexImage3D
</refentrytitle></citerefentry>,
227 <citerefentry><refentrytitle>glTexSubImage1D
</refentrytitle></citerefentry>,
228 <citerefentry><refentrytitle>glTexSubImage2D
</refentrytitle></citerefentry>,
229 <citerefentry><refentrytitle>glTexSubImage3D
</refentrytitle></citerefentry>,
230 <citerefentry><refentrytitle>glTexParameter
</refentrytitle></citerefentry>
233 <refsect1 id=
"Copyright"><title>Copyright
</title>
235 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
236 Silicon Graphics, Inc. This document is licensed under the SGI
237 Free Software B License. For details, see
238 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.