next up previous contents index
Next: Texture Parameters Up: 3.8 Texturing Previous: Texture Image Specification

Alternate Texture Image Specification Commands

Texture images may also be specified using image data taken directly from the framebuffer, and rectangular subregions of existing texture images may be respecified.

The command

void CopyTexImage2D ( enum target, int level, enum internalformat, int x, int y, sizei width, sizei height, int border ) ;

defines a two-dimensional texture array in exactly the manner of TexImage2D , except that the image data are taken from the framebuffer rather than from client memory. Currently, target must be TEXTURE_2D. x, y, width, and height correspond precisely to the corresponding arguments to CopyPixels  (refer to section 4.3.3); they specify the image's width and height, and the lower left coordinates of the framebuffer region to be copied. The image is taken from the framebuffer exactly as if these arguments were passed to CopyPixels , with argument type set to COLOR, stopping after pixel transfer processing is complete. Subsequent processing is identical to that described for TexImage2D , beginning with clamping of the R, G, B, and A values from the resulting pixel groups. Parameters level, internalformat, and border are specified using the same values, with the same meanings, as the equivalent arguments of TexImage2D , except that internalformat may not be specified as 1, 2, 3, or 4. An invalid value specified for internalformat generates the error INVALID_ENUM. The constraints on width, height, and border are exactly those for the equivalent arguments of TexImage2D .

The command

void CopyTexImage1D ( enum target, int level, enum internalformat, int x, int y, sizei width, int border ) ;

defines a one-dimensional texture array in exactly the manner of TexImage1D , except that the image data are taken from the framebuffer, rather than from client memory. Currently, target must be TEXTURE_1D. For the purposes of decoding the texture image, CopyTexImage1D  is equivalent to calling CopyTexImage2D  with corresponding arguments and height of 1, except that the height of the image is always 1, regardless of the value of border. level, internalformat, and border are specified using the same values, with the same meanings, as the equivalent arguments of TexImage1D , except that internalformat may not be specified as 1, 2, 3, or 4. The constraints on width and border are exactly those of the equivalent arguments of TexImage1D .

Four additional commands,

void TexSubImage1D ( enum target, int level, int xoffset, sizei width, enum format, enum type, void *data ) ;

void TexSubImage2D ( enum target, int level, int xoffset, int yoffset, sizei width, sizei height, enum format, enum type, void *data ) ;

void CopyTexSubImage1D ( enum target, int level, int xoffset, int x, int y, sizei width ) ;

void CopyTexSubImage2D ( enum target, int level, int xoffset, int yoffset, int x, int y, sizei width, sizei height ) ;

respecify only a rectangular subregion of an existing texture array. No change is made to the internalformat, width, height, or border parameters of the specified texture array, nor is any change made to texel values outside the specified subregion. Currently the target arguments of TexSubImage1D  and CopyTexSubImage1D  must be TEXTURE_1D, and the target arguments of TexSubImage2D  and CopyTexSubImage2D  must be TEXTURE_2D. The level parameter of each command specifies the level of the texture array that is modified. If level is less than zero or greater than the base 2 logarithm of the maximum texture width or height, the error INVALID_VALUE is generated.

TexSubImage2D  arguments width, height, format, type, and data match the corresponding arguments to TexImage2D , meaning that they are specified using the same values, and have the same meanings. Likewise, TexSubImage1D  arguments width, format, type, and data match the corresponding arguments to TexImage1D . CopyTexSubImage2D  arguments x, y, width, and height match the corresponding arguments to CopyTexImage2D . And CopyTexSubImage1D  arguments x, y, and width match the corresponding arguments to CopyTexImage1D . Each of the four TexSubImage  commands interprets and processes pixel groups in exactly the manner of its TexImage  counterpart, except that the assignment of R, G, B, and A pixel group values to the texture components is controlled by the internalformat of the texture array, not by an argument to the command.

Arguments xoffset and yoffset of TexSubImage2D  and CopyTexSubImage2D  specify the lower left texel coordinates of a width-wide by height-high rectangular subregion of the texture array. Negative values of xoffset and yoffset correspond to the coordinates of border texels, addressed as in Figure 3.10. Taking , , and to be the specified width, height, and border width of the texture array, (not the actual array dimensions , , and ), and taking x, y, w, and h to be the xoffset, yoffset, width, and height argument values, any of the following relationships generates the error INVALID_VALUE:

(Recall that and include twice the specified border width .) Counting from zero, the nth pixel group is assigned to the texel with coordinates , where

The xoffset argument of TexSubImage1D  and CopyTexSubImage1D  specifies the left texel coordinate of a width-wide subregion of the texture array. Negative values of xoffset correspond to the coordinates of border texels. Taking and to be the specified width and border width of the texture array, and x and w to be the xoffset and width argument values, either of the following relationships generates the error INVALID_VALUE:

Counting from zero, the nth pixel group is assigned to the texel with internal integer coordinates , where



next up previous contents index
Next: Texture Parameters Up: 3.8 Texturing Previous: Texture Image Specification



David Blythe
Sat Mar 29 02:23:21 PST 1997