Graphics Reference
In-Depth Information
width
the width of the base image in pixels
the height of the base image in pixels
height
(
glTexStorage3D
only) the depth of the base image
in pixels
depth
Once the immutable texture is created, it is invalid to call
glTexImage*
,
glCompressedTexImage*
,
glCopyTexImage*
, or
glTexStorage*
on
the texture object. Doing so will result in a
GL_INVALID_OPERATION
error being generated. To fill the immutable texture with image data,
the application needs to use
glTexSubImage2D
,
glTexSubImage3D
, or
glGenerateMipMap
, or else render to the image as a texture (by using it as
an attachment to a framebuffer object).
Internally, when
glTexStorage*
is used, OpenGL ES marks the texture
object as being immutable by setting
GL_TEXTURE_IMMUTABLE_FORMAT
to
GL_TRUE
and
GL_TEXTURE_IMMUTABLE_LEVELS
to the number of levels
passed to
glTexStorage*
. The application can query for these values by
using
glGetTexParameter[i|f][v]
, although it cannot set them directly.
The
glTexStorage*
function must be used to set up the immutable
texture parameters.
In Chapter 6, “Vertex Attributes, Vertex Arrays, and Buffer Objects,” we
introduced buffer objects, concentrating the discussion on vertex buffer
objects (VBOs) and copy buffer objects. As you will recall, buffer objects
allow the storage of data in server-side (or GPU) memory as opposed to
client-side (or host) memory. The advantage of using buffer objects is
that they reduce the transfer of data from CPU to GPU and, therefore,
can improve performance (as well as reduce memory utilization).
OpenGL ES 3.0 also introduces
pixel unpack buffer
objects
that are bound
and specified with the
GL_PIXEL_UNPACK_BUFFER
target. The functions
that operate on pixel unpack buffer objects are described in Chapter 6.
Pixel unpack buffer objects allow the specification of texture data that
resides in server-side memory. As a consequence, the pixel unpack
operations
glTexImage*
,
glTexSubImage*
,
glCompressedTexImage*
,
and
glCompressedTexSubImage*
can come directly from a buffer object.
Much like VBOs with
glVertexAttribPointer
, if a pixel unpack buffer
object is bound during one of those calls, the
data
pointer is an offset into
the pixel unpack buffer rather than a pointer to client memory.