glCompressedTexImage2D Function

Syntax

GL_APICALL void GL_APIENTRY glCompressedTexImage2D(
     GLenum target,
     GLint level,
     GLenum internalformat,
     GLsizei width,
     GLsizei height,
     GLint border,
     GLsizei imageSize,
     const void * data
);

Arguments

Name Description
in target Target texture.
in level Mipmap level of the data to load.
in internalformat Texture format. (GL_ETC1_RGB8_NATIVE_DMP or GL_ETC1_RGB8_A4_NATIVE_DMP.)
in width Texture width.
in height Texture height
in border Border width (0 is the only valid value).
in imageSize Texture data size
in data Pointer to the texture data.

Return Values

No values are returned.

Description

Loads texture data in a compressed format.

Set target to one the following values.

GL_TEXTURE_2D 2D texture.
GL_TEXTURE_CUBE_MAP_NEGATIVE_X Face of a cube-map texture in the negative x direction.
GL_TEXTURE_CUBE_MAP_POSITIVE_X Face of a cube-map texture in the positive x direction.
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y Face of a cube-map texture in the negative y direction.
GL_TEXTURE_CUBE_MAP_POSITIVE_Y Face of a cube-map texture in the positive y direction.
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z Face of a cube-map texture in the negative z direction.
GL_TEXTURE_CUBE_MAP_POSITIVE_Z Face of a cube-map texture in the positive z direction.

To specify the region that is accessed by the GPU, set target to a bitwise OR of the aforementioned and following values.

NN_GX_MEM_FCRAMThe GPU accesses FCRAM.
NN_GX_MEM_VRAMAThe GPU accesses VRAMA.
NN_GX_MEM_VRAMBThe GPU accesses VRAMB. You can also specify whether copies of data are generated in FCRAM by including the following values in the bitwise OR.
GL_COPY_FCRAM_DMPCopies of data are generated in FCRAM.
GL_NO_COPY_FCRAM_DMPCopies of data are not generated in FCRAM.

These combinations cause data to be transferred as follows.

(NN_GX_MEM_FCRAM | GL_NO_COPY_FCRAM_DMP)The GPU directly accesses the region specified by data.
(NN_GX_MEM_VRAMA | GL_NO_COPY_FCRAM_DMP)A region is allocated in VRAMA; data is transferred to VRAMA via DMA; and then the GPU accesses VRAMA.
(NN_GX_MEM_VRAMB | GL_NO_COPY_FCRAM_DMP)A region is allocated in VRAMB; data is transferred to VRAMB via DMA; and then the GPU accesses VRAMB.
(NN_GX_MEM_FCRAM | GL_COPY_FCRAM_DMP)A region is allocated in FCRAM; data is copied to FCRAM via the CPU; and then the GPU accesses FCRAM.
(NN_GX_MEM_VRAMA | GL_COPY_FCRAM_DMP)A region is allocated in VRAMA and FCRAM; data is copied to FCRAM via the CPU, then transferred from FCRAM to VRAMA via DMA; and then the GPU accesses VRAMA.
(NN_GX_MEM_VRAMB | GL_COPY_FCRAM_DMP)A region is allocated in VRAMB and FCRAM; data is copied to FCRAM via the CPU, then transferred from FCRAM to VRAMB via DMA; and then the GPU accesses VRAMB.

If you do not specify which region is accessed by the GPU or whether data is copied to FCRAM, (NN_GX_MEM_FCRAM | GL_COPY_FCRAM_DMP) is used. (These settings cannot be specified for POD.)

Set level to a negative value that is equal to the number of mipmaps to load for the texture data stored in data. (For example, specify a value of -2 to load two mipmap levels and a value of -3 to load three mipmap levels.)

If you set level to 0 or -1, it is recognized as indicating the minimum single-level mipmap.

For internalformat, you can specify either GL_ETC1_RGB8_NATIVE_DMP or GL_ETC1_ALPHA_RGB8_A4_NATIVE_DMP.

Set width and height to the texture size of the data to load. Specify the size of level 0 when you load multiple mipmap levels of data. With GL_ETC1_RGB8_NATIVE_DMP, the texture size must be a power of 2 between 16 and 1024, inclusive.

Specify 0 for border.

Set imageSize to the number of bytes of data specified by data.

Set data to a pointer to the texture data to load. When data is loaded for multiple mipmap levels, it is stored in ascending level order starting with level 0. You cannot separately load the individual mipmap levels of the data. When data is set to NULL, this function simply allocates a region as large as the data size.

This function generates the following errors.

GL_INVALID_OPERATIONThis function was called without any command-list objects bound when DMA transfers were in use.
GL_INVALID_VALUEThe width, height, internalformat, border, or level argument was set to an invalid value.
GL_INVALID_OPERATIONThe imageSize argument was set to a value of 0 or less.
GL_INVALID_ENUMThe target argument was set to an invalid value.
GL_INVALID_OPERATIONThe target argument was set to an invalid transfer method.

Revision History

2010/11/29
Added GL_ETC1_ALPHA_RGB8_A4_NATIVE_DMP, which had been omitted by mistake, as one of the specifiable values for internalformat.
2010/01/07
Initial version.

CONFIDENTIAL