44
Chapter 3: Specifying the Appearance of Geometries
Specifying a Texture Image
To apply a texture to a geometry, supply a csTexture object in the argument of
setTexture(). csTexture is a class consisting of the following fields and default values:
csSFString filename “noName”
csMFRef imageLevel[]
csSFEnum format 0
csSFEnum repeat_S REPEAT
csSFEnum repeat_T REPEAT
csSFEnum minFilter FAST
csSFEnum magFilter FAST
csSFEnum source 0
imageLevel is an array of MIPmap levels for this texture of type csImages. If this field is
not set or has all NULL values, the texture is loaded from csSFString fileName instead.
format is the pixel format of the image. For more information about pixel format, see
“Color Components” on page 47.
repeat_S and repeat_T specify whether or not the texture is repeated in the s and t
directions on the geometry, respectively. If the texture is not repeated, it is clamped.
minFilter specifies what to do with texels that project smaller than a screen pixel.
Possible values include NEAREST_MIN, LINEAR_MIN, or MIPMAP.
magFilter specifies what to do with texels that project larger than a screen pixel. Possible
values include NEAREST_MAX or LINEAR_MAX.
Texture Mode Settings
The texture mode method allows you to specify texture rendering speed, quality, and
perspective where speed and quality, and speed and perspective are trade-offs.
You specify the mode of the texture rendering using setTexMode() with one of the
following arguments from csContext::TexModeEnum:
FAST_TEX for a low quality, more quickly-rendered texture.
NICE_TEX for a high quality, more slowly-rendered texture.
NON_PERSP_TEX
for a non-perspectively-correct, more quickly-rendered texture.
PERSP_TEX for a more slowly-rendered texture in perspective.