; TextureName Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5 light=CreateLight() RotateEntity light,45,45,0 ; One texture loaded from disk, one created in code disk_tex=LoadTexture("media/b3dlogo.jpg") code_tex=CreateTexture(128,128) SetBuffer TextureBuffer(code_tex) ClsColor 200,120,40 Cls SetBuffer BackBuffer() cube=CreateCube() PositionEntity cube,0,1,0 EntityTexture cube,disk_tex current=disk_tex While Not KeyDown(1) ; Space swaps the cube between the two textures If KeyHit(57) If current=disk_tex Then current=code_tex Else current=disk_tex EntityTexture cube,current EndIf ; TextureName returns the file a texture was loaded from name$=TextureName$(current) If name$="" Then name$="(empty - this texture was made with CreateTexture)" If Len(name$)>52 Then name$="..."+Right$(name$,49) TurnEntity cube,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Space: swap texture Arrows: camera Esc: exit" Text 0,20,"TextureName$(current) = "+name$ Flip Wend End