back buffer!

Started by
2 comments, last by Ersvik 21 years, 7 months ago
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
Johan
Advertisement
What error code do you get?

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
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
Johan
nevermind

[edited by - RapidStunna on August 28, 2002 11:11:21 AM]

This topic is closed to new replies.

Advertisement