dxLoadTexture%(file$,flags%)

Parameters

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

flags (optional) - texture flag:
1: dxColor (default)
2: Alpha
4: Masked
8: Mipmapped
16: Clamp U
32: Clamp V
64: Spherical environment map
128: Cubic environment map
256: Store texture in vram
512: Force the use of high dxColor textures

Description

Load a texture from an image file and returns the texture's handle. Supported file formats include: BMP, PNG, TGA and JPG. Only PNG and TGA support alpha.


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.


See dxCreateTexture for more detailed descriptions of the texture flags.


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 dxTextureFilter command. The default for the dxTextureFilter command is 9 (1+8), which is a coloured, mipmapped texture. This cannot be overridden via the flags parameter of the dxLoadTexture command - if you wish for the filters to be removed you will need to use the dxClearTextureFilters command, which must be done after setting the graphics mode (setting the graphics mode restores the default texture filters).

See also: dxCreateTexture, dxLoadAnimTexture.

Example

; dxLoadTexture Example
; -------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()

light=dxCreateLight()
dxRotateEntity light,90,0,0

cube=dxCreateCube()
dxPositionEntity cube,0,0,5

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

; Texture cube with texture
dxEntityTexture cube,tex

While Not dxKeyDown( 1 )

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

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

dxTurnEntity cube,pitch#,yaw#,roll#

dxRenderWorld
dxFlip

Wend

End

Index