Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
55.6 frames per second
#1
Hello,

How I can draw smooth animation?
In the attached code, the X jumps or stutters as it moves from left to right.

Things I tried that have not improved the smoothness:

use _Limit 60 instead of the Wait function
Re-arrange Waits to be before or after _Display

The FPS measurement timer settles on 55.6 fps, which I find to be strange.
This is regardless of how I set the Vertical Sync mode in my GPU drivers.
My display refresh rate is set to 60.0 fps.

Code: (Select All)

'Issue I'm seeing is that I am not getting an expected 60 fps screen update.
' Defocus your eyes by looking at the caret: ^
' and watch the X trail across the screen as it misses or stutters.
' For some strange reason I get 55.6 frames per second regardless of vsync on or off in graphics drivers.

Dim Shared fps As Single
Dim Shared fpsLast As Single
Dim Shared X As Integer

_Title "Framerate check"
Screen _NewImage(640, 480, 32)

timerFps = _FreeTimer
On Timer(timerFps, 10) UpdateFps

fps = 0
Timer(timerFps) On

_Display 'this causes autodisplay=off

X = 1
Do:
    Cls , _RGB32(28, 28, 22)
    Call Render

    Locate 1, 60: Print "FPS:";
    If fpsLast = 0.0 Then
        Print "wait"
    Else
        Print fpsLast
    End If

    '_Limit 60

    Wait &H3DA, 8, 8
    _Display
    Wait &H3DA, 8

    fps = fps + 1
Loop Until _KeyHit = 27
End


Sub Render
    If X < 1 Then X = 1
    If X > _Width / 8 Then X = 1

    Locate 10, X
    Print "X"
    X = X + 1

    Locate 11, _Width / 16
    Print "^"
End Sub

Sub UpdateFps
    fpsLast = fps / 10.0
    fps = 0.0
End Sub


[Image: 55-6-fps.png]
Reply


Messages In This Thread
55.6 frames per second - by Haggarman - 11-18-2023, 02:09 AM
RE: 55.6 frames per second - by TerryRitchie - 11-18-2023, 05:28 AM
RE: 55.6 frames per second - by Haggarman - 11-18-2023, 05:47 AM
RE: 55.6 frames per second - by TerryRitchie - 11-18-2023, 03:12 PM
RE: 55.6 frames per second - by bplus - 11-18-2023, 12:29 PM
RE: 55.6 frames per second - by bplus - 11-18-2023, 12:54 PM
RE: 55.6 frames per second - by SMcNeill - 11-18-2023, 03:59 PM
RE: 55.6 frames per second - by Haggarman - 11-18-2023, 10:09 PM
RE: 55.6 frames per second - by TerryRitchie - 11-19-2023, 03:05 AM
RE: 55.6 frames per second - by DSMan195276 - 11-19-2023, 02:59 AM
RE: 55.6 frames per second - by DSMan195276 - 11-19-2023, 04:41 PM
RE: 55.6 frames per second - by a740g - 11-20-2023, 01:10 AM
RE: 55.6 frames per second - by grymmjack - 11-23-2023, 03:33 AM
RE: 55.6 frames per second - by SMcNeill - 11-20-2023, 01:19 AM



Users browsing this thread: 8 Guest(s)