Graphics3D 640,480,32,2
SetBuffer BackBuffer()
Global camera=CreateCamera()
CameraZoom camera,16
light=CreateLight()
RotateEntity light,90,0,0
earthsphere=CreateSphere(32)
PositionEntity earthsphere,0,0,32
EntityPickMode earthsphere,1
earthtexture=LoadTexture("media/earth.bmp")
EntityTexture earthsphere,earthtexture
While Not KeyDown( 1 )
; WireFrame
If KeyHit( 44 )=True Then
WireFrame 1
Else If KeyHit( 45 )=True Then
WireFrame 0
End If
If MouseHit(1) Then
CameraPick(camera,MouseX(),MouseY())
TFormPoint PickedX#(),PickedY#(),PickedZ#(),earthsphere,0
CameraProject(camera,TFormedX#(),TFormedY#(),TFormedZ#())
EndIf
;up
If KeyDown( 200 ) Then TurnEntity earthsphere,-2,0,0
;down
If KeyDown( 208 ) Then TurnEntity earthsphere,2,0,0
;left
If KeyDown( 203 ) Then TurnEntity earthsphere,0,-2,0
;right
If KeyDown( 205 ) Then TurnEntity earthsphere,0,2,0
UpdateWorld
RenderWorld
Text 0,0,"FPS: "+Framecounter_framerate
Text 0,20,"PickedX: "+TFormedX#()
Text 0,40,"PickedY: "+TFormedY#()
Text 0,60,"PickedZ: "+TFormedZ#()
Text 0,80,"ProjectedX: "+ProjectedX#()
Text 0,100,"ProjectedY: "+ProjectedY#()
Flip
Wend
End