Graphics Reference
In-Depth Information
ES 3.0 applications that draw to the display will have a color buffer for both
the front and back buffers. The buffer that is currently the front or back
is determined by the most recent call to
eglSwapBuffers
(described in
Chapter 3, “An Introduction to EGL”). When you copy image data out of
the color buffer from a displayable EGL surface, you will always be copying
the contents of the back buffer. If you are rendering to an EGL pbuffer, then
copying will occur from the pbuffer surface. Finally, if you are rendering to
a framebuffer object, then the framebuffer object color attachment to copy
from is set by calling
glReadBuffer
with
GL_COLOR_ATTACHMENTi
.
void
glReadBuffer
(GLenum
mode
)
specifies the color buffer to read from. This will
set the source color buffer for future calls to
glReadPixels
,
glCopyTexImage2D
,
glCopyTexSubImage2D
, and
glCopyTexSubImage3D
. The value can be either
GL_BACK
,
GL_COLOR_ATTACHMENTi
, or
GL_NONE
.
mode
The functions to copy data from the color buffer to a texture are
glCopyTexImage2D
,
glCopyTexSubImage2D
, and
glCopyTexSubImage3D
.
void
glCopyTexImage2D
(GLenum
target,
GLint
level,
GLenum
internalFormat,
GLint
x,
GLint
y,
GLsizei
width,
GLsizei
height,
Glint
border
)
specifies the texture target, either
GL_TEXTURE_2D
or
one of the cubemap face targets
(GL_TEXTURE_CUBE_MAP_POSITIVE_X
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X, and so on
)
target
specifies which mip level to load
level
internalFormat
the internal format of the image; can be
GL_ALPHA
,
GL_LUMINANCE
,
GL_LUMINANCE_ALPHA
,
GL_RGB
,
GL_RGBA
,
GL_R8
,
GL_RG8
,
GL_RGB565
,
GL_RGB8
,
GL_RGBA4
,
GL_RGB5_A1
,
GL_RGBA8
,
GL_RGB10_A2
,
GL_SRGB8
,
GL_SRGB8_ALPHA8
,