Flip and Flip 1 are different

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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.
Graphics 800,600,32,26
Local frame:Int = 0
Local fps:Int = 0
Local x:Int = 0
Local Time = MilliSecs() + 1000
While Not KeyHit(KEY_ESCAPE)
	Cls
	DrawText fps,10,10
	DrawRect x,300,100,100
	x :+ 4
	If x >= 800 Then x = 0
	Flip -1
	frame = frame+1
	If MilliSecs() >= Time
		fps = frame
		frame = 0
		Time :+ 1000
	End If
Wend


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.