Archived

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

DDraw backbuffer problem

This topic is 5504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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
}

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites