Hi dugzilla.
Just to add to what Mustang posted, you might be interested in this small piece of code.
Graphics3D 800,600,32
SetBuffer BackBuffer()
WireFrame 0
AntiAlias 0
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) ; Lock to 60FPS.
slowmo% = False
wiref% = False
cam = CreateCamera()
PositionEntity cam,0,0,-15
light = CreateLight()
; --- Main loop ---
While Not KeyHit(1)
frame_start = MilliSecs()
; Press ENTER to toggle slow motion.
If KeyHit(28) Then slowmo = Not slowmo
; Press BACKSPACE to toggle wireframe.
If KeyHit(14) Then wiref = Not wiref : WireFrame wiref
UpdateWorld
RenderWorld
frame_time = MilliSecs() - frame_start
show_info()
WaitTimer(fps_timer)
Flip True
If slowmo Then Delay 200
Wend
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
I have that code stored in a file called 'template.bb' which I load whenever I want to quickly try an idea out in B3D. It contains all the basic stuff, including an FPS timer.
I also changed the file's attributes to make it 'read only'. This forces me to save it under a different name (usually test.bb) when using it to do a test prog.