Archived

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

back buffer!

This topic is 5584 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

Hi, does anyone see what''s wrong with the following setup code. It works fine until trying to acquire the back buffer.
	
DirectDrawCreateEx( NULL, (void**)&pDirectDraw, IID_IDirectDraw7, NULL );
	
DWORD dwFlags	= DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT;
pDirectDraw->SetCooperativeLevel( hWnd, dwFlags );
	
pDirectDraw->SetDisplayMode( Width, Height, BPP, 0, 0 );
DDSURFACEDESC2 ddsd;
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;
pDirectDraw->CreateSurface( &ddsd, &pFrontBuffer, NULL );
		
DDSCAPS2 ddsCaps;
ddsCaps.dwCaps	= DDSCAPS_BACKBUFFER;
pFrontBuffer->GetAttachedSurface( &ddsCaps, &pBackBuffer );
 
So, why doesn''t it work? Thanks, Johan Ersvik

Share this post


Link to post
Share on other sites
Hi, got error code DDERR_NOTFOUND, and it was due to that I didnt know what the DDSCAPS2 struct looked like. I had to ZeroMemory the struct first as the dwCaps member was only one of four. So, the problem is solved and everybody is happy :-)


Johan Ersvik

Share this post


Link to post
Share on other sites