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_CUBE_MAP_POSITIVE_X
</constant>,
44 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X
</constant>,
45 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y
</constant>,
46 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
</constant>,
47 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z
</constant>,
48 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
</constant>, or
49 <constant>GL_PROXY_TEXTURE_CUBE_MAP
</constant>.
54 <term><parameter>level
</parameter></term>
57 Specifies the level-of-detail number.
58 Level
0 is the base image level.
59 Level
<emphasis>n
</emphasis> is the
<emphasis>n
</emphasis>th mipmap reduction image.
64 <term><parameter>internalformat
</parameter></term>
67 Specifies the format of the compressed image data stored at address
<parameter>data
</parameter>.
72 <term><parameter>width
</parameter></term>
75 Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
76 <inlineequation><mml:math>
77 <!-- eqn: 2 sup n + 2 ( border ):-->
79 <mml:msup><mml:mn>2</mml:mn>
80 <mml:mi mathvariant=
"italic">n
</mml:mi>
86 <mml:mfenced open=
"(" close=
")">
87 <mml:mi mathvariant=
"italic">border
</mml:mi>
91 </mml:math></inlineequation>
93 <inlineequation><mml:math><mml:mi mathvariant=
"italic">n
</mml:mi></mml:math></inlineequation>.
95 implementations support
2D texture images that are at least
64 texels
96 wide and cube-mapped texture images that are at least
16 texels wide.
101 <term><parameter>height
</parameter></term>
104 Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
106 <inlineequation><mml:math>
107 <!-- eqn: 2 sup n + 2 ( border ):-->
109 <mml:msup><mml:mn>2</mml:mn>
110 <mml:mi mathvariant=
"italic">n
</mml:mi>
115 <mml:mo>⁡</mml:mo>
116 <mml:mfenced open=
"(" close=
")">
117 <mml:mi mathvariant=
"italic">border
</mml:mi>
121 </mml:math></inlineequation>
123 <inlineequation><mml:math><mml:mi mathvariant=
"italic">n
</mml:mi></mml:math></inlineequation>.
125 implementations support
2D texture images that are at least
64 texels
126 high and cube-mapped texture images that are at least
16 texels high.
131 <term><parameter>border
</parameter></term>
134 Specifies the width of the border.
135 Must be either
0 or
1.
140 <term><parameter>imageSize
</parameter></term>
143 Specifies the number of unsigned bytes of image data starting at the
144 address specified by
<parameter>data
</parameter>.
149 <term><parameter>data
</parameter></term>
152 Specifies a pointer to the compressed image data in memory.
158 <refsect1 id=
"description"><title>Description
</title>
160 Texturing maps a portion of a specified texture image onto each graphical
161 primitive for which texturing is enabled. To enable and disable
162 two-dimensional texturing, call
<citerefentry><refentrytitle>glEnable
</refentrytitle></citerefentry> and
<citerefentry><refentrytitle>glDisable
</refentrytitle></citerefentry> with argument
163 <constant>GL_TEXTURE_2D
</constant>. To enable and disable texturing using
164 cube-mapped textures, call
<citerefentry><refentrytitle>glEnable
</refentrytitle></citerefentry> and
<citerefentry><refentrytitle>glDisable
</refentrytitle></citerefentry> with argument
165 <constant>GL_TEXTURE_CUBE_MAP
</constant>.
168 <function>glCompressedTexImage2D
</function> loads a previously defined, and retrieved, compressed two-dimensional
169 texture image if
<parameter>target
</parameter> is
<constant>GL_TEXTURE_2D
</constant> (see
<citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry>).
172 If
<parameter>target
</parameter> is
<constant>GL_PROXY_TEXTURE_2D
</constant>, no data is read from
<parameter>data
</parameter>, but
173 all of the texture image state is recalculated, checked for consistency,
174 and checked against the implementation's capabilities. If the
175 implementation cannot handle a texture of the requested texture size, it
176 sets all of the image state to
0, but does not generate an error (see
177 <citerefentry><refentrytitle>glGetError
</refentrytitle></citerefentry>). To query for an entire mipmap array, use an image array level
178 greater than or equal to
1.
181 <parameter>internalformat
</parameter> must be an extension-specified compressed-texture format.
182 When a texture is loaded with
<citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry> using a generic compressed
183 texture format (e.g.,
<constant>GL_COMPRESSED_RGB
</constant>), the GL selects from one of
184 its extensions supporting compressed textures. In order to load the
185 compressed texture image using
<function>glCompressedTexImage2D
</function>, query the compressed texture image's
186 size and format using
<citerefentry><refentrytitle>glGetTexLevelParameter
</refentrytitle></citerefentry>.
189 If a non-zero named buffer object is bound to the
<constant>GL_PIXEL_UNPACK_BUFFER
</constant> target
190 (see
<citerefentry><refentrytitle>glBindBuffer
</refentrytitle></citerefentry>) while a texture image is
191 specified,
<parameter>data
</parameter> is treated as a byte offset into the buffer object's data store.
194 <refsect1 id=
"notes"><title>Notes
</title>
196 <function>glCompressedTexImage2D
</function> is available only if the GL version is
1.3 or greater.
199 Non-power-of-two textures are supported if the GL version is
2.0 or greater, or if the implementation exports the
<constant>GL_ARB_texture_non_power_of_two
</constant> extension.
202 <refsect1 id=
"errors"><title>Errors
</title>
204 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>internalformat
</parameter> is one of the generic compressed internal formats:
<constant>GL_COMPRESSED_ALPHA
</constant>,
205 <constant>GL_COMPRESSED_LUMINANCE
</constant>,
<constant>GL_COMPRESSED_LUMINANCE_ALPHA
</constant>,
206 <constant>GL_COMPRESSED_INTENSITY
</constant>,
<constant>GL_COMPRESSED_RGB
</constant>, or
207 <constant>GL_COMPRESSED_RGBA
</constant>.
210 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>imageSize
</parameter> is not consistent with
211 the format, dimensions, and contents of the specified compressed image
215 <constant>GL_INVALID_OPERATION
</constant> is generated if parameter combinations are not
216 supported by the specific compressed internal format as specified in the
217 specific texture compression extension.
220 <constant>GL_INVALID_OPERATION
</constant> is generated if a non-zero buffer object name is bound to the
221 <constant>GL_PIXEL_UNPACK_BUFFER
</constant> target and the buffer object's data store is currently mapped.
224 <constant>GL_INVALID_OPERATION
</constant> is generated if a non-zero buffer object name is bound to the
225 <constant>GL_PIXEL_UNPACK_BUFFER
</constant> target and the data would be unpacked from the buffer
226 object such that the memory reads required would exceed the data store size.
229 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glCompressedTexImage2D
</function>
230 is executed between the execution of
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>
231 and the corresponding execution of
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
234 Undefined results, including abnormal program termination, are generated if
235 <parameter>data
</parameter> is not encoded in a manner consistent with the extension
236 specification defining the internal compression format.
239 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
241 <citerefentry><refentrytitle>glGetCompressedTexImage
</refentrytitle></citerefentry>
244 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_TEXTURE_COMPRESSED
</constant>
247 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_PIXEL_UNPACK_BUFFER_BINDING
</constant>
250 <citerefentry><refentrytitle>glGetTexLevelParameter
</refentrytitle></citerefentry> with arguments
<constant>GL_TEXTURE_INTERNAL_FORMAT
</constant>
251 and
<constant>GL_TEXTURE_COMPRESSED_IMAGE_SIZE
</constant>
254 <citerefentry><refentrytitle>glIsEnabled
</refentrytitle></citerefentry> with argument
255 <constant>GL_TEXTURE_2D
</constant> or
<constant>GL_TEXTURE_CUBE_MAP
</constant>
258 <refsect1 id=
"seealso"><title>See Also
</title>
260 <citerefentry><refentrytitle>glActiveTexture
</refentrytitle></citerefentry>,
261 <citerefentry><refentrytitle>glColorTable
</refentrytitle></citerefentry>,
262 <citerefentry><refentrytitle>glCompressedTexImage1D
</refentrytitle></citerefentry>,
263 <citerefentry><refentrytitle>glCompressedTexImage3D
</refentrytitle></citerefentry>,
264 <citerefentry><refentrytitle>glCompressedTexSubImage1D
</refentrytitle></citerefentry>,
265 <citerefentry><refentrytitle>glCompressedTexSubImage2D
</refentrytitle></citerefentry>,
266 <citerefentry><refentrytitle>glCompressedTexSubImage3D
</refentrytitle></citerefentry>,
267 <citerefentry><refentrytitle>glConvolutionFilter1D
</refentrytitle></citerefentry>,
268 <citerefentry><refentrytitle>glCopyPixels
</refentrytitle></citerefentry>,
269 <citerefentry><refentrytitle>glCopyTexImage1D
</refentrytitle></citerefentry>,
270 <citerefentry><refentrytitle>glCopyTexSubImage1D
</refentrytitle></citerefentry>,
271 <citerefentry><refentrytitle>glCopyTexSubImage2D
</refentrytitle></citerefentry>,
272 <citerefentry><refentrytitle>glCopyTexSubImage3D
</refentrytitle></citerefentry>,
273 <citerefentry><refentrytitle>glDrawPixels
</refentrytitle></citerefentry>,
274 <citerefentry><refentrytitle>glMatrixMode
</refentrytitle></citerefentry>,
275 <citerefentry><refentrytitle>glPixelStore
</refentrytitle></citerefentry>,
276 <citerefentry><refentrytitle>glPixelTransfer
</refentrytitle></citerefentry>,
277 <citerefentry><refentrytitle>glTexEnv
</refentrytitle></citerefentry>,
278 <citerefentry><refentrytitle>glTexGen
</refentrytitle></citerefentry>,
279 <citerefentry><refentrytitle>glTexImage2D
</refentrytitle></citerefentry>,
280 <citerefentry><refentrytitle>glTexImage3D
</refentrytitle></citerefentry>,
281 <citerefentry><refentrytitle>glTexSubImage1D
</refentrytitle></citerefentry>,
282 <citerefentry><refentrytitle>glTexSubImage2D
</refentrytitle></citerefentry>,
283 <citerefentry><refentrytitle>glTexSubImage3D
</refentrytitle></citerefentry>,
284 <citerefentry><refentrytitle>glTexParameter
</refentrytitle></citerefentry>
287 <refsect1 id=
"Copyright"><title>Copyright
</title>
289 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
290 Silicon Graphics, Inc. This document is licensed under the SGI
291 Free Software B License. For details, see
292 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.