Archived

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

JonW

Flipping Chain vs. Offscreen Surface

Recommended Posts

Hello, Are there any advantages of using Flip to double buffer, as opposed to just making an offscreen backbuffer and Blit-ing it to the primary surface? I wouldn't think you would notice any speed improvements. The reason I ask is a want to add a windowed mode to my game, and it would be easier to just use an offscreen surface all the time instead of managing both methods. Thanks in advance. [Edited by - JonW on February 20, 2008 1:45:40 PM]

Share this post


Link to post
Share on other sites
hi,

first, i''m not sure that flip method''s allowed in windowed mode.
i''ll explain why....

The main difference between to use flip method and blitting method is performance.

when you blit your backbuffer on primary, you copy (!) the memory.
When you call flip function, DirectDraw just change pointer''adress between the primary and the backbuffer, ther''s no memory copied!

that''s why it increase performance, and that''s why i think you can''t use flip method in windowed mode, of course both surface must have same dimension.

anyway, refer to the official documentation, to fix it.

i hope that you understand me, with my so bad english i know that''s difficult....

i try to improve it !

++
VietCoder

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think the more important issue is why are you finding it hard to manage both methods? It really shouldn''t be.

Share this post


Link to post
Share on other sites
Thanks for the quick replies.

I don''t really mind managing two different methods, but it would be easier not to have to.

Something like this:

m_lpddsPrimary->BlitFast (m_lpddsBackBuffer, ...);

Is simpler than this:

if (m_bFullscreen)
m_lpddsPrimary->Flip (m_lppdsBackBuffer, ...);

else
m_lpddsPrimary->BlitFast (m_lpddsBackBuffer, ...);

But I guess that is not a very good example. The creation code would be longer

Oh well, call me lazy.

Share this post


Link to post
Share on other sites
You should do both. Use offscreen surfaces for your bitmaps and when you whant your game to run smooth then flip surfaces and dont forget to use Cls().


p.s. You will have to create the function Cls() but it pretty simple and there are some tutorials on the net to do so

Kevin

Share this post


Link to post
Share on other sites
With page flipping you don''t have to copy anything, the back buffer becomes the front buffer instantly. This uses more memory, but this doesn''t matter anymore. Video card now have more ram then my whole computer a few years ago

in windowed mode you don''t have the whole frontbuffer to yourself so you have to copy. The VRAM runs at like 500MHZ DDR now so it doesn''t really matter!!! I get over 600 fps in 800x600x32bit windowed mode if not much is drawn. Also with the copy method you can alpha-blend the scene onto the front-buffer

They both use the same memory, two surfaces!

Share this post


Link to post
Share on other sites
quote:
Original post by JonWoyame
Will I see any performance hit if I use Blit instead of Flip for fullscreen mode also?


Just to reiterate, absolutely.

If you want a bit of extra performance, at the cost of a chunk of v.mem, look into triple buffering.

Share this post


Link to post
Share on other sites