heres a little better version:
Graphics3D 800,600,32
SetBuffer BackBuffer()
SeedRnd MilliSecs()
Global frame_count%
Global fps%
Global slowest_fps%
Global fps_timeout%
Global frame_time%
Global slowest_frame%
Global frame_start%
fps_timer = CreateTimer(60)
slowmo% = False
wiref% = False
cam = CreateCamera()
PositionEntity cam,0,50,-35
light = CreateLight()
plane = CreatePlane()
;RotateEntity plane,-90,0,0
EntityColor plane,80,55,100
NameEntity plane,"The Plane"
EntityPickMode plane,2
PositionEntity plane,0,0,0
; Main loop
While Not KeyHit(1)
frame_start = MilliSecs()
If KeyHit(28) Then slowmo = Not slowmo
;If KeyHit(14)
; wiref = Not wiref
; WireFrame wiref
;EndIf
If MouseHit(1)
pent =CameraPick(cam,MouseX(),MouseY())
pentt$=EntityName$(pent)
px# = PickedX()
py# = PickedY()
pz# = PickedZ()
EndIf
UpdateWorld
RenderWorld
Rect MouseX(),MouseY(),2,2,1
Text 10,100,"Entity: "+pentt$
Text 10,120,"x: "+px
Text 10,130,"y: "+py
Text 10,140,"z: "+pz
frame_time = MilliSecs() - frame_start
show_info()
WaitTimer(fps_timer)
Flip(1)
If slowmo Then Delay 200
Wend
ClearWorld
End
;
; Display debug info
;
Function show_info()
If fps_timeout
frame_count = frame_count + 1
If MilliSecs() > fps_timeout Then
fps_timeout = MilliSecs() + 1000
fps = frame_count
frame_count = 0
If fps < slowest_fps Or slowest_fps = 0 Then slowest_fps = fps
EndIf
If frame_time > slowest_frame Then slowest_frame = frame_time
Color 0,255,0
Text 10,10," Triangles: " + TrisRendered()
Color 255,255,0
Text 10,25," Millisecs: " + frame_time
Text 10,40," Slowest: " + slowest_frame
Color 0,255,255
Text 10,55," FPS: " + fps
Text 10,70," Worst: " + slowest_fps
Color 255,255,255
Else
; First call initialization.
fps_timeout = MilliSecs() + 1000
EndIf
End Function
For more fun, make a height map and replace the plane with a textured terrain, then the pickY() will give you numbers generally greater than 0.0