11-19-2023, 04:41 PM
(11-19-2023, 03:05 AM)TerryRitchie Wrote: Has anyone else run the example code with the changes I suggested and noticed any frame skipping?
Yes, I see it both with the original `Wait` and with a `_Limit 60`, but it's hard to tell with just the "X".
(11-19-2023, 03:05 AM)TerryRitchie Wrote: Update: DSMan posted while I was writing this. So there is an issue with QB64? Why am I getting a rock solid 60FPS then?
I didn't clarify in my post, but I suspect you're really not. You can't actually measure the FPS in a QB64 program, you can only measure the speed you're loop is producing frames via calling `_Display`. The window is supposed to get redrawn at 60 FPS regardless of anything your program does. _Limit 60 will get you pretty close to synced with the separate thread drawing the window, but stutter will still happen, and actually happens a lot more often due to that noted 55.6 FPS issue that screws everything up even more.
I would try out this program and check what you see, it's inspired by what @bplus mentioned. It draws green and red circles on alternating frames at 60 FPS, and on my (garbage...) monitors when that perfectly syncs up it just appears like a darkish yellow. When it stutters, I see a green or red circle for a moment. A big thing to keep in mind, regardless of what you see, is that the pattern should be consistent if there was no stuttering, if you're seeing any kind of random flashing then that means frames are being dropped or missed:
Code: (Select All)
SCREEN _NEWIMAGE(640, 480, 32)
COLOR &HFFFFFFFF, _RGB32(28, 28, 22)
DO
DIM c AS LONG
IF (X MOD 2) = 0 THEN
c = _RGB32(0, 255, 0)
ELSE
c = _RGB32(255, 0, 0)
END IF
CIRCLE (640 / 2, 480 / 2), 100, c,
PAINT (640 / 2, 480 / 2), c
_DISPLAY
_LIMIT 60
X = X + 1
LOOP
Here's another version you could try as well, this is a little different and uses a `_Limit 120` to attempt to create twice as many frames as can be displayed on the window. If you're getting a perfectly synced result then you should only see a green circle as all the frames with the red circle will get dropped before you see them. When I actually run it, I just get random flickering, occasionally it stays stable for a while and sometimes it starts flickering significant amounts:
Code: (Select All)
SCREEN _NEWIMAGE(640, 480, 32)
COLOR &HFFFFFFFF, _RGB32(28, 28, 22)
DO
DIM c AS LONG
IF (X MOD 2) = 0 THEN
c = _RGB32(0, 255, 0)
ELSE
c = _RGB32(255, 0, 0)
END IF
CIRCLE (640 / 2, 480 / 2), 100, c,
PAINT (640 / 2, 480 / 2), c
_DISPLAY
_LIMIT 120
X = X + 1
LOOP