Graphics Reference
In-Depth Information
The additional functions support texture lookups for shadow textures or
for
level-of-detail
(“LOD”) in shaders. Functions whose names include
Lod
are
allowed only in vertex shaders. The bias term is optional for fragment shaders,
but is not accepted for vertex shaders. If it is included, it is added to the level
of detail before the texture access.
Use the texture coordinate
coord
to do a
texture lookup in the 1D texture currently
bound to
sampler
. For the projective
(Proj)
versions, the texture coordinate
coord.s
is divided by the last component
of
coord
.
vec4 texture( sampler1D sampler,
float coord [, float bias])
vec4 textureProj( sampler1D sampler,
vec{2,4} coord [, float bias])
vec4 textureLod( sampler1D sampler,
float coord, float lod)
vec4 textureProjLod( sampler1D sampler,
vec{2,4} coord, float lod)
vec4 texture( sampler2D sampler,
vec2 coord [, float bias])
vec4 textureProj( sampler2D sampler,
vec{3,4} coord [, float bias])
vec4 textureLod( sampler2D sampler,
vec2 coord, float lod)
vec4 textureProjLod( sampler2D sampler,
vec{3,4} coord, float lod)
Use the texture coordinate
coord
to do
a texture lookup in the 2D texture cur-
rently bound to
sampler
. For the projec-
tive
(Proj)
versions, the texture coordi-
nate
(coord.s, coord.t)
is divided by
the last component of
coord
. The third
component of
coord
is ignored for the
vec4 coord
variant.
vec4 texture( sampler3D sampler,
vec3 coord [, float bias])
vec4 textureProj( sampler3D sampler,
vec4 coord [, float bias])
vec4 textureLod( sampler3D sampler,
vec3 coord, float lod)
vec4 textureProjLod( sampler3D sampler,
vec4 coord, float lod)
Use the texture coordinate
coord
to do a
texture lookup in the 3D texture currently
bound to
sampler
. For the projective
(Proj)
versions, the texture coordinate is
divided by
coord.q
.
Use the texture coordinate
coord
to do a
texture lookup in the cube map texture
currently bound to
sampler
. The direc-
tion of
coord
is used to select in which
face to do a two-dimensional texture
lookup.
vec4 texture( samplerCube sampler,
vec3 coord [, float bias])
vec4 textureLod( samplerCube sampler,
vec3 coord, float lod)