Updating a b3d texture?

Blitz3D Forums/Blitz3D Programming/Updating a b3d texture?

Boiled Sweets(Posted 2005) [#1]
Hi I have a b3d created with Wings3d and Giles and I want to apply a different texture to it in real time - how can I do this?


nrasool(Posted 2005) [#2]
Hi there,

Could you not simply just use the Entitytexture command, here is an 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( "moss.bmp" ) 
tex1=LoadTexture ("Rock.bmp")

; Texture cube with texture 
EntityTexture cube,tex 

While Not KeyDown( 1 ) 

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

If KeyDown (2) = True Then EntityTexture cube,tex 
If KeyDown (3) = True Then EntityTexture cube,tex1 
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 



OJay(Posted 2005) [#3]
findchild -> your mesh
getentitybrush -> brush of your mesh
brushtexture -> texturehandle of the brush

see manual for more...


Ross C(Posted 2005) [#4]
Remember to free the brush and texture this creates :o)


Boiled Sweets(Posted 2005) [#5]
Ooops - I was loading my mesh with LoadAnimMesh not LoadMesh - works now - ta