DDraw backbuffer problem

Started by
5 comments, last by Prototype 21 years, 4 months ago
I''m using DX5 for a platform scroller targeted at lower end machines. To gain some videomem, I decided to fall back to double buffering (it was using triple buffers at 640x480x16). But when I set backbuffers to 1 the screen gets messed up, resulting in some sort of delayed, interlaced display. I can''t figure out why this is happening while my setup code is quite plain and standard (it''s on my laptop so I can''t post it right now). Maybe one of you has experienced this as well and has a solution or other thoughts. Thanks in advance.
Advertisement
Do the DDraw SDK samples that perform flipping have this same problem on your machine?
Are you still trying to load to a non-existant buffer?
Dunno about the samples, I don''t have any SDK installed as I use the header files that came with VC. Could this be a problem? Didn''t have any problems with it so far.
(I have the DX5 docs though, which leads me to thinking it has something to do with DDFLIP_WAIT / DDERR_WASSTILLDRAWING).
Well I''m going to do some more investigation, might be back soon

Tnx so far.
I might be able to help if you can post some code.

Also, you can error Check like this:

Instead of:

lpDD->CreateSurface(Whatever);

if(FAILED(lpDD->CreateSurface(Whatever)))
{
//it''s not workin'', Pa!!!
return 0; //or whatever
}
Programmers of the world, UNTIE!
Ok, here's how I create the flipping chain (should be familiar):


      ... memset( &ddsd, 0, sizeof(ddsd) ); ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; //Create Primary Surface ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary_, NULL ); if( ddrval != DD_OK )  return DXError( DXERR_INIT, "Create primary surface"); lpDDSPrimary_->QueryInterface( IID_IDirectDrawSurface3, (void**)&lpDDSPrimary ); lpDDSPrimary_->Release(); DDSCAPS ddscaps; ZeroMemory( &ddscaps, sizeof( ddscaps ) ); ddscaps.dwCaps = DDSCAPS_BACKBUFFER; ddrval = lpDDSPrimary->GetAttachedSurface( &ddscaps, &lpDDSBack ); if( ddrval != DD_OK )  return DXError( DXERR_INIT, "GetAttachedSurface");...      



Note: with dwBackbuffer to 2, it runs flawlessly.
(edit: sorry, source tag screws up identation)


[edited by - Prototype on November 22, 2002 2:17:57 PM]
OK problem solved. I had to use DDBLTFAST_WAIT when blitting.
Thanks for the help.

This topic is closed to new replies.

Advertisement