GLBasic forum

Main forum => GLBasic - en => Topic started by: Richard Rae on 2007-Aug-04

Title: fps?
Post by: Richard Rae on 2007-Aug-04
When I use the following code on my PC  I only get an FPS of 30 even though it has been set to 60.The same happens on my laptop.

                    // FPS counter

LIMITFPS 60

WHILE TRUE


 dtime = GETTIMER()
 
 fps = ((1000/dtime))
 delay=delay+dtime
 IF delay>500 // 1/2 sec
  delay=0
  showfps=fps
 ENDIF
 
 PRINT "FPS: "+showfps+" dtime:"+dtime, 0,0
 PRINT actual,0,50
 SHOWSCREEN

WEND

Any ideas?
Title: fps?
Post by: Schranz0r on 2007-Aug-04
Sync off, on youre Graphiccard !
Title: fps?
Post by: Kitty Hello on 2007-Aug-04
Uh-Oh. A bug in GETTIMER.
Try this:
Code (glbasic) Select
LIMITFPS 60

WHILE TRUE
time = GETTIMERALL()
dtime = time - oldtime
oldtime = time

fps = ((1000/dtime))
delay=delay+dtime
IF delay>1000 // 1/2 sec
 delay=0
 showfps=fps
ENDIF

PRINT "FPS: "+showfps+" dtime:"+dtime+" dtime2:"+dtime2, 0,0
PRINT actual,0,50
dtime2 = GETTIMER()
SHOWSCREEN
WEND
Fixed in the next update.