Graphics Reference
In-Depth Information
(continued)
width
the width in pixels of the region to read
height
the height in pixels of the region to read
This function will update the subregion of the image starting at (
xoffset
,
yoffset
) to (
xoffset
+
width
- 1,
yoffset
+
height
- 1) with the pixels in the
color buffer from (
x
,
y
) to (
x
+
width
- 1,
y
+
height
- 1).
Finally, you can also copy the contents of the color buffer into a slice (or
subregion of a slice) of a previously specified 3D texture or 2D texture
array using
glCopyTexSubImage3D.
void
glCopyTexSubImage3D
(GLenum
target,
GLint
level
,
GLint
xoffset
, GLint
yoffset
,
GLint
zoffset
, GLint
x
, GLint
y
,
GLsizei
width
, GLsizei
height
)
specifies the texture target, either
GL_TEXTURE_3D
or
GL_TEXTURE_2D_ARRAY
target
specifies which mip level to update
level
the
x
index of the texel to start updating from
xoffset
the
y
index of the texel to start updating from
yoffset
the
z
index of the texel to start updating from
zoffset
the
x
window-coordinate of the lower-left rectangle in the
framebuffer to read from
x
the
y
window-coordinate of the lower-left rectangle in the
framebuffer to read from
y
the width in pixels of the region to read
width
the height in pixels of the region to read
height
One thing to keep in mind with
glCopyTexImage2D
,
glCopyTexSubImage2D
, and
glCopyTexSubImage3D
is that the texture
image format cannot have more components than the color buffer. In
other words, when copying data out of the color buffer, it is possible
to convert to a format with fewer components, but not with more.
TableĀ 9-13 shows the valid format conversions when doing a texture
copy. For example, you can copy an RGBA image into any of the possible
formats, but you cannot copy an RGB into an RGBA image because no
alpha component exists in the color buffer.