LoadTexture ( file$[,flags] )  

Parameters:

file$ - filename of image file to be used as texture

flags (optional) - texture flag:
1: Color
2: Alpha
4: Masked
8: Mipmapped
16: Clamp U
32: Clamp V
64: Spherical reflection map

Description:

Load a texture from an image file and returns the texture's handle.

The optional flags parameter allows you to apply certain effects to the texture. Flags can be added to combine two or more effects, e.g. 3 (1+2) = texture with colour and alpha maps.

Here are quick descriptions of the flags:
1: Color - colour map, what you see is what you get.
2: Alpha - alpha map. If an image contains an alpha map, this will be used to make certain areas of the texture transparent. Otherwise, the colour map will be used as an alpha map. With alpha maps, the dark areas always equal hihg-transparency, light areas equal low-transparency.
4: Masked - all areas of a texture coloured 0,0,0 will not be drawn to the screen.
8: Mipmapped - low detail versions of the texture will be used at high distance. Results in a smooth, blurred look.
16: Clamp u - clamp u texture co-ordinates. Prevents texture wrapping.
32: Clamp v - clamp v texture co-ordinates. Prevents texture wrapping.
64: Spherical reflection map - environment mapping, for that shiny, teapot look.

Something to consider when applying texture flags to loaded textures is that the texture may have already had certain flags applied to it via the TextureFilter command. The default for the TextureFilter command is 9 (1+8), which is a coloured, mipmapped texture. This cannot be overridden via the flags parameter of LoadTexture command - if you wish for the filters to be removed you will need to use the ClearTextureFilters command.

See also: CreateTexture, LoadAnimTexture.

Example:

; LoadTexture Example
; -------------------

Graphics3D 640,480
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,90,0,0

cube=CreateCube()
PositionEntity cube,0,0,5

; Load texture
tex=LoadTexture("../media/b3dlogo.jpg")

; Texture cube with texture
EntityTexture cube,tex

While Not KeyDown( 1 )

pitch#=0
yaw#=0
roll#=0

If KeyDown( 208 )=True Then pitch#=-1
If KeyDown( 200 )=True Then pitch#=1
If KeyDown( 203 )=True Then yaw#=-1
If KeyDown( 205 )=True Then yaw#=1
If KeyDown( 45 )=True Then roll#=-1
If KeyDown( 44 )=True Then roll#=1

TurnEntity cube,pitch#,yaw#,roll#

RenderWorld
Flip

Wend

End

Index