Graphics Reference
In-Depth Information
Table 9-13
Valid Format Conversions for
glCopyTex*Image*
(To) Texture Format
Color Format
(From)
A
L
LA
R
RG
RGB
RGBA
R
N
Y
N
Y
N
N
N
RG
N
Y
N
Y
Y
N
N
RGB
N
Y
N
Y
Y
Y
N
RGBA
Y
Y
Y
Y
Y
Y
Y
Previously in the chapter, we covered how to set texture parameters
such as filter modes, texture coordinate wrap modes, and LOD
settings using
glTexParameter[i
|
f][v]
. The issue with using
glTexParameter[i
|
f][v]
is that it can result in a significant amount
of unnecessary API overhead. Very often, an application will use the
same texture settings for a large number of textures. In such a case,
having to set the sampler state with
glTexParameter[i
|
f][v]
for
every texture object can result in a lot of extra overhead. To mitigate
this problem, OpenGL ES 3.0 introduces
sampler objects
that separate
sampler state from texture state. In short, all of the settings that can
be set with
glTexParameter[i
|
f][v]
can be set for a sampler object
and can be bound for use with a texture unit in a single function call.
Sampler objects can be used across many textures and, therefore, reduce
API overhead.
The function used to generate sampler objects is
glGenSamplers
.
void
glGenSamplers
(GLsizei
n,
GLuint *
samplers
)
specifies the number of sampler objects to generate
n
an array of unsigned integers that will hold
n
sampler
object IDs
samplers
Sampler objects also need to be deleted when an application no longer
needs them. This can be done using
glDeleteSamplers
.