vertical tearing

BlitzMax Forums/BlitzMax Programming/vertical tearing

As far as I can make out, BMax only does soft syncing in windows mode (makes sense). A 'hertz' value of 0 makes BMax always do a 'Flip 1'. This means that you're really doing a 'Flip 0', hence the tearing.

Try this (again)...
Graphics 800, 600, 0, 15 'set 'hertz' To 0 And try not to blink

Local x#, y#
Local xv# = Rnd(-4, 4), yv# = Rnd(-4, 4)
Local flipVar = -1
Local refreshRate = GetDeviceCaps(GetDC(PrimaryDevice.hWnd), VREFRESH)

Repeat
	x# :+ xv#
	If (x# < 0) Or (x# > 799)
		xv# = -xv#
		x# :+ xv#
	EndIf 
	
	y# :+ yv#
	If (y# < 0) Or (y# > 599)
		yv# = -yv#
		y# :+ yv#
	EndIf
	
	If KeyHit(KEY_SPACE)
		flipVar :+ 1
		If flipVar > 1 Then flipVar = -1
	EndIf
	
	Cls
	DrawOval x# - 15, y# - 15, 30, 30
	
	DrawText "Flip = " + flipVar, 12, 12
	DrawText "Screen Refresh = " + refreshRate, 12, 24
	
	Flip flipVar
Until KeyHit(KEY_ESCAPE)

End