Jump to content
  • Advertisement
Sign in to follow this  
Zero107314

DirectDraw BackBuffer Problem

This topic is 4612 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've got a problem. The last call (GetAttachedSurface) always return an error. Why? Can anyone help me, please?
LPDIRECTDRAW7			lpDD = NULL;				// DirectDraw-Objekt
LPDIRECTDRAWSURFACE7	lpDDSPrimary = NULL;		// FrontBuffer
LPDIRECTDRAWSURFACE7	lpDDSBack = NULL;			// BackBuffer
bool DirectDrawInit(HWND hWnd)
{
	DDSURFACEDESC2 ddsd;
	DDSCAPS2 ddscaps;

	if (FAILED( DirectDrawCreateEx(NULL, (LPVOID*)&lpDD, IID_IDirectDraw7, NULL) )) 
		return(false);
	
	if (FAILED( lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) )) 
		return(false);
	
	if (FAILED( lpDD->SetDisplayMode(SCREEN_X, SCREEN_Y, SCREEN_D, 0, 0) ))
		return(false);

	ZeroMemory(&ddsd, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
	ddsd.dwBackBufferCount = 1;

	if (FAILED( lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL) ))
		return(false);

	ddscaps.dwCaps = DDSCAPS_BACKBUFFER;

	if (FAILED( lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack) ))
		return(false);

	return(true);
}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!