Name

glCopyTexImage2D - specify a two-dimensional texture image with pixels from the color buffer

C Specification

void glCopyTexImage2D(GLenum target,
    GLint level,
    GLenum internalformat,
    GLint x,
    GLint y,
    GLsizei width,
    GLsizei height,
    GLint border)

Parameters

target

Specifies the target texture. Must be GL_TEXTURE_2D.

level

Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

internalformat

Specifies the color components of the texture. Must be one of the following symbolic constants: GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, or GL_RGBA.

x, y

Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

width

Specifies the width of the texture image. Must be 0 or 2n + 2border for some integer n.

height

Specifies the height of the texture image. Must be 0 or 2m + 2border for some integer m.

border

Specifies the width of the border. Must be 0.

Description

glCopyTexImage2D defines a two-dimensional texture image with pixels from the color buffer.

The screen-aligned pixel rectangle with lower left corner at (x, y) and with a width of width + 2border and a height of height + 2border defines the texture array at the mipmap level specified by level. internalformat specifies the color components of the texture.

The red, green, blue, and alpha components of each pixel that is read are converted to an internal fixed-point or floating-point format with unspecified precision. The conversion maps the largest representable component value to 1.0, and component value 0 to 0.0. The values are then converted to the texture's internal format for storage in the texel array.

internalformat must be chosen such that color buffer components can be dropped during conversion to the internal format, but new components cannot be added. For example, an RGB color buffer can be used to create LUMINANCE or RGB textures, but not ALPHA, LUMINANCE_ALPHA or RGBA textures.

Pixel ordering is such that lower x and y screen coordinates correspond to lower s and t texture coordinates.

If any of the pixels within the specified rectangle of the color buffer are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.

Notes

An image with height or width of 0 indicates a null-texture.

Errors

GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D.

GL_INVALID_OPERATION is generated if internalformat is not compatible with the color buffer format.

GL_INVALID_VALUE is generated if level is less than 0.

GL_INVALID_VALUE may be generated if level is greater than log2max, where max is the returned value of GL_MAX_TEXTURE_SIZE.

GL_INVALID_VALUE is generated if width or height is less than 0, greater than GL_MAX_TEXTURE_SIZE, or if width or height cannot be represented as 2k + 2border for some integer k.

GL_INVALID_VALUE is generated if border is not 0.

GL_INVALID_ENUM is generated if internalformat is not an accepted constant.

Associated Gets

glGet with argument GL_MAX_TEXTURE_SIZE

Copyright

Copyright © 2003-2004 Silicon Graphics, Inc.

This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.

See Also

glCompressedTexImage2D, glCopyTexSubImage2D, glGet, glTexEnv, glTexImage2D, glTexSubImage2D, glTexParameter