Flip and Flip 1 are different

BlitzMax Forums/MiniB3D Module/Flip and Flip 1 are different

ImaginaryHuman(Posted 2007) [#1]
On my system, it appears that `Flip` by itself will run at approximately a smooth 60Hz but there will be vertical tearing, whilst `Flip 1` fixes the tearing. Is this normal? From the definition in the docs, Flip by itself defaults to -1 which means it syncs to the refresh rate but not necessarily synchronized with the vertical blank?

Anyway, the demo's that come with MiniB3D all have Flip and not Flip 1, which means they all have vertical tearing, for me anyway. I change them all to Flip 1.

From the docs:

Function Flip( sync=-1 )
Description Flip current graphics object.
Information Flip swap the front and back buffers of the current graphics objects.

If sync is 0, then the flip occurs as soon as possible. If sync is 1, then the flip occurs on the next vertical blank.

If sync is -1 and the current graphics object was created with the Graphics command, then flips will occur at the graphics object's refresh rate regardless of whether or not the graphics hardware supports such a refresh rate.

If sync is -1 and the current graphics object was NOT created with the Graphics command, then the flip will occur on the next vertical blank.


LT(Posted 2007) [#2]
I believe it's Flip (VWait) like BlitzBasic, but perhaps VWait defaults to FALSE instead of TRUE...?


ImaginaryHuman(Posted 2007) [#3]
No its -1 0 or 1 and it defaults to -1


LAB[au](Posted 2007) [#4]
I don't know if it's normal ... but I do the same (Flip 1) as I have tearing on both my Linux and my Win32 boxes. It seems to disappear with fullscreen modes as well, there I don't need flip 1.


ImaginaryHuman(Posted 2007) [#5]
I get the tearing in fullscreen and windowed.


TomToad(Posted 2007) [#6]
Here's my understanding:

Flip -1 flips at a fixed rate independent of the monitor's refresh rate

Flip 0 flips immediately.

Flip 1 flips at a fixed rate synchronized to the monitor's vertical blank.

Since Flip -1 does not take into account the vertical blank, it will most likely produce tearing. However it allows you to flip at fixed rates regardless of whether the monitor/graphics card supports that rate or not.

Since Flip 0 does not take into account the vertical blank, it will most likely tear. However, it allows your program to execute frames as fast as possible, giving you smoother movement and more accurate physics. Also good for testing just how efficient your program is running

Since Flip 1 takes into account the vertical blank, you should not get any tearing. However, you can only set rates supported by the graphics card/monitor.

Try this out, replacing the refresh rate and the flip parameter. Notice that Flip -1 will run at 26 fps even though there are no cards that support it, but you get tearing. However, use flip 1 and since no cards support that rate, you get 60 fps instead of 26, but there is no tearing.


Edit: This is different from Blitz3D which only has Flip False (Flip 0) and Flip True (Flip 1), but nothing like Flip -1 in BlitzMAX.


Hotcakes(Posted 2007) [#7]
Actually B3D's version of Flip accepted a value that determined the number of VWaits to wait. Flip True or Flip 1 waited for the next vertical refresh, while Flip 2 would give you half the framerate, Flip 3 a third and so on.


TomToad(Posted 2007) [#8]
Hotcakes: I don't think that's right. There is nothing in the docs about that and testing does not show it. I get the same frame rate regardless if I use Flip1, Flip2, etc...