Unlimited FPS

Previous topic - Next topic

doimus

I have written a simple image parser which extracts data from a bitmap using GETPIXEL and stores values into an array.

Although I haven't used LIMITFPS command in my case, it seems GLB is locked to 60 FPS unless told otherwise.

GETPIXEL command is affected by LIMITFPS as well, so it runs much slower at default value than if I set LIMITFPS to some crazy number like 5000.

So, it would be nice if, for example, LIMITFPS 0 turned off frame per second limitation completely.

Kitty Hello

limitfps -1 is no limit '(unless your gfx card has it set to the monitor refresh rate)

Moru

If you have no use for displaying anything in the extraction loop, doesn't help to just leave out showscreen totally? That way GLBasic should run full speed without loosing any processing time on displaying anything on the screen.

doimus

Quote from: Kitty Hello on 2009-Jun-29
limitfps -1 is no limit '(unless your gfx card has it set to the monitor refresh rate)

There's something strange going on here.

I tried other, graphically more intensive example:

If I set LIMITFPS to 60 it runs at 60fps, I guess.
If I set it to -1 it runs fast.
If I set it to 60000 it runs EVEN FASTER!  :o



@Moru - yeah, that worked, if I lose showscreen altogether it's as fast as possible, but I wanted to have it displayed just as a visual reference.

Kitty Hello

limitfps -1 limits to 500 actually, otherwise internal timers trouble.

Moru

If you just want a visual que on how far the process it, set up a timer to only update the screen every now and then, like every second.

Hemlos

Heres a function to calculate fps every second.

This is what im using to test my particle Engine.

Just put this right before showscreen:
Code (glbasic) Select
FPS(TRUE)

And it will post fps in the top left corner.

Code (glbasic) Select
FUNCTION FPS: ShowFpsBOOL  //STABLE FPS!
// 1 sec update, using law of averaging :)
// Extremely Accurate i believe, and easy to read.
//
// For Every frame update with this instead:
// FPSValue = INTEGER(1000 / (GETTIMERALL()-Tim)) ; Tim = GETTIMERALL()
//
// ShowFpsBOOL=BOOL expression tells function to print the value to the corner of the screen
//
// Usage: myfpsvalue=FPS(FALSE)
// Updates a stable FPSValue Every One Second Interval:

STATIC TimeBuffer,FrameCount, FPSValue
LOCAL FrameTime

FrameTime=GETTIMER(); TimeBuffer=TimeBuffer+FrameTime; FrameCount=FrameCount+1
IF TimeBuffer>999; TimeBuffer=TimeBuffer-1000; FPSVALUE=FrameCount; FrameCount=0; ENDIF
IF ShowFpsBOOL=TRUE THEN PRINT "FPS="+FPSVALUE,10,10

RETURN FPSValue

ENDFUNCTION
Bing ChatGpt is pretty smart :O

Hemlos

#7
Cool i didnt know that..
Hes right, limitfps 6000 makes it unlimited.
limitfps -1 delimits to 500 for me.

i get 650 fps with a mousestate and a keyboard() function, and a fps() function.



PS. my video card has always been set to verticle_sync: "force off".
Bing ChatGpt is pretty smart :O