; FreeTexture Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 crate=CreateCube() PositionEntity crate,0,0,5 ; Load a texture and apply it to the crate tex=LoadTexture("media/b3dlogo.jpg") EntityTexture crate,tex While Not KeyDown(1) ; Space frees the texture. Entities that were already textured keep ; their own copy, so the crate is unaffected. If KeyHit(57) And tex<>0 FreeTexture tex tex=0 EndIf TurnEntity crate,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: free the texture Arrows: camera Esc: exit" If tex<>0 Text 0,20,"Texture loaded - press Space to call FreeTexture" Else Text 0,20,"FreeTexture called - the crate keeps its texture" EndIf Flip Wend End