101 lines
3.2 KiB
HTML
101 lines
3.2 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>LoadTexture ( file$[,flags] )</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
file$ - filename of image file to be used as texture
|
|
<br />
|
|
|
|
<br />
|
|
flags (optional) - texture flag:
|
|
<br />
|
|
1: Color (default)
|
|
<br />
|
|
2: Alpha
|
|
<br />
|
|
4: Masked
|
|
<br />
|
|
8: Mipmapped
|
|
<br />
|
|
16: Clamp U
|
|
<br />
|
|
32: Clamp V
|
|
<br />
|
|
64: Spherical environment map
|
|
<br />
|
|
128: Cubic environment map
|
|
<br />
|
|
256: Store texture in vram
|
|
<br />
|
|
512: Force the use of high color textures
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
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.
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
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.
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
See <a class=small href=../3d_commands/CreateTexture.htm>CreateTexture</a> for more detailed descriptions of the texture flags.
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
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 <a class=small href=../3d_commands/TextureFilter.htm>TextureFilter</a> command. The default for the <a class=small href=../3d_commands/TextureFilter.htm>TextureFilter</a> command is 9 (1+8), which is a coloured, mipmapped texture. This cannot be overridden via the flags parameter of the LoadTexture command - if you wish for the filters to be removed you will need to use the <a class=small href=../3d_commands/ClearTextureFilters.htm>ClearTextureFilters</a> command, which must be done after setting the graphics mode (setting the graphics mode restores the default texture filters).
|
|
<br>
|
|
<br>
|
|
See also: <a class=small href=CreateTexture.htm>CreateTexture</a>, <a class=small href=LoadAnimTexture.htm>LoadAnimTexture</a>.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../3d_examples/LoadTexture.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; LoadTexture Example
|
|
<br />
|
|
; -------------------
|
|
<br />
|
|
|
|
<br />
|
|
Graphics3D 640,480
|
|
<br />
|
|
SetBuffer BackBuffer()
|
|
<br />
|
|
|
|
<br />
|
|
camera=CreateCamera()
|
|
<br />
|
|
|
|
<br />
|
|
light=CreateLight()
|
|
<br />
|
|
RotateEntity light,90,0,0
|
|
<br />
|
|
|
|
<br />
|
|
cube=CreateCube()
|
|
<br />
|
|
PositionEntity cube,0,0,5
|
|
<br />
|
|
|
|
<br />
|
|
; Load texture
|
|
<br />
|
|
tex=LoadTexture( "media/b3dlogo.jpg" )
|
|
<br />
|
|
|
|
<br />
|
|
; Texture cube with texture
|
|
<br />
|
|
EntityTexture cube,tex
|
|
<br />
|
|
|
|
<br />
|
|
While Not KeyDown( 1 )
|
|
<br />
|
|
|
|
<br />
|
|
pitch#=0
|
|
<br />
|
|
yaw#=0
|
|
<br />
|
|
roll#=0
|
|
<br />
|
|
|
|
<br />
|
|
If KeyDown( 208 )=True Then pitch#=-1
|
|
<br />
|
|
If KeyDown( 200 )=True Then pitch#=1
|
|
<br />
|
|
If KeyDown( 203 )=True Then yaw#=-1
|
|
<br />
|
|
If KeyDown( 205 )=True Then yaw#=1
|
|
<br />
|
|
If KeyDown( 45 )=True Then roll#=-1
|
|
<br />
|
|
If KeyDown( 44 )=True Then roll#=1
|
|
<br />
|
|
|
|
<br />
|
|
TurnEntity cube,pitch#,yaw#,roll#
|
|
<br />
|
|
|
|
<br />
|
|
RenderWorld
|
|
<br />
|
|
Flip
|
|
<br />
|
|
|
|
<br />
|
|
Wend
|
|
<br />
|
|
|
|
<br />
|
|
End
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=LoadTexture&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|