this Flip Command

Blitz3D Forums/Blitz3D Programming/this Flip Command

Clarks(Posted 2005) [#1]
i dont know what the deal is. it maybe only happens with geforce cards but flip(true) gives me quicker screen updates than flip(false) when doing 2d drawing from what i've tested.

i always taught flip(false) was faster.


Sledge(Posted 2005) [#2]

from what i've tested



There's a couple of things. First, running windowed can screw things up so if you're not testing fullscreen then switch over and test again. Secondly, you can disable v-syncing (on which the True part of Flip True is based) in your GFX card's drivers, removing the difference between flipping False and True, so check those. Thirdly, the following should give you some idea of how much faster things can be if you don't wait for the vertical blank. It should cook when you press space, if it doesn't then let us know because you've got a problem.

Graphics 640,480,0,1

myImage=CreateImage(32,32)
SetBuffer ImageBuffer(myImage)
Color 255,0,0 : Rect 0,0,32,32,True

x=640

SetBuffer BackBuffer()

While Not KeyDown(1)

x=x-1
If x<-32 Then x=x+640

DrawBlock myImage,x,50 

If KeyDown(57)
	Flip False
Else
	Flip True
EndIf

Cls
Wend



By the way, I've got a GeForce and if I run the above windowed it screws up - something to do with double buffering being "faked" in that mode from what I hear on this board.


EDIT: Took out a debug line that attempted to fix the screwy windowed behaviour.


Clarks(Posted 2005) [#3]
sledge you're right

so i guess its a rule that when your windowed, flip true
and flip false when youre not.

if its faked i wonder why its happening because its not convenient.

thanks.


Sledge(Posted 2005) [#4]

so i guess its a rule that when your windowed, flip true
and flip false when youre not.


I don't like to see tearing so I'd say "always flip true", but flipping false when windowed is particularly bad news and to be avoided, yes.


if its faked i wonder why its happening because its not convenient.



I guess it's tied to the way that Windows updates the screen and the disparity in where the last virtual scanline is as far as your app is concerned, where it physically rests on (or even off!) screen depending on the vertical position of the window, and the actual position of the genuine last scanline according to the dimensions of the desktop. If your application is playing nice, flipping true and waiting until the entire desktop is redrawn before considering the next frame then all is well, but you can appreciate how messy things can quickly become if it refuses to wait. (Just think - a non cpu-bound application running in a small window can have supplied the graphical data for several frames in the time it takes the OS to update the larger desktop on which it sits just once. Are those frames lost, are they buffered or is the application suspended? I don't know, but clearly there are bound to be problems if your application does not cooperate.)


big10p(Posted 2005) [#5]
You could try using VWait instead. From the manual:

Note that this command is different to the vertical blank waiting mechanism in Flip because Flip will cause the graphics card (as opposed to the CPU) to wait for the next vertical blank. The vertical blank can be disabled on some graphics cards, hence it is quite common to use "VWait : Flip False" to ensure consistent updates on all setups.