Archived

This topic is now archived and is closed to further replies.

Ridcully

DDraw Flip() and VSync

Recommended Posts

as i understand it, Flip waits until the monitor has completed one vertical drawing cycle. then it exchanges the back and frontbuffer and therefore you don''t get tearing. so, now if you disable VSync in your videodriver, Flip SHOULD be unaffected according to the dx documentation which says that Flip always waits for the VSync. but in my app (and the dx-sample apps) it doesn''t. the screen is tearing like hell in fullscreen. that doesn''t happen to other commercial products that use ddraw, so there is bound to be a workaround. any suggestions? ridcully

Share this post


Link to post
Share on other sites
This sounds more like a bug in your app. I''ve never had problems with tearing in DD. Maybe you could post the part of your code that flips the surfaces so that we can see if anythings wrong.

--TheGoop

-------------------------
If cities were built like software is built, the first woodpecker to come along would level civilization

Share this post


Link to post
Share on other sites
i think you misunderstood me. just look at any of the ms-samples such as "boids". it is tearing like hell on three pcs (all with voodoo cards) if you turn of vsync.
so it is definitely not my code that is wrong.
currently i am just using a normal blit from the backbuffer to the frontbuffer, that works better, yet slower

ridcully

Share this post


Link to post
Share on other sites
I think the whole point is that turning off VSync in the video driver fools DirectX into thinking it is always ready to flip. You''re overriding it at a hardware level. That is why the option is there - you are testing raw throughput for the card regardless of any code considerations for tearing.

Share this post


Link to post
Share on other sites
If you want to force VSync, there is a DirectDraw function called WaitForVerticalBlank(). You can call this right before your flip.
This will wait for the vertical retrace even if it is diabled in the drivers.
I have used this, and it has worked for me.

Share this post


Link to post
Share on other sites
Kylotan: okay, i think this is right, BUT: if you turn of vsync and run a commercial game like half-life, you get higher framerates than your refreshrate AND don''t get tearing. does half-life just drop the frames that are over the refreshrate and count them nevertheless...?

Milkman: i did already try that, and it works, but in erratic intervals the screen flashes very ugly... could you please post your code so i can see what i am doing wrong?

thanks
ridcully

Share this post


Link to post
Share on other sites