Original Post
I''m writing a windowed application that uses direct x7.
for some reason when I add a backbuffer it fails to create the primary surface?? has anyone encountered this before. Any advice would be appreciated. here''s the code.
DirectDrawCreateEx(NULL,(VOID**)&g_pDD,IID_IDirectDraw7,NULL);
g_pDD->SetCooperativeLevel( hwnd, DDSCL_NORMAL);
g_pDD->CreateClipper(NULL,&g_pddClipper,NULL);
g_pddClipper->SetHWnd(0,hwnd);
//primary surface
DDSURFACEDESC2 desc;
ZeroMemory(&desc, sizeof(desc));
desc.dwSize = sizeof(desc);
desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP | DDSCAPS_COMPLEX;
desc.dwBackBufferCount = 1;
if(FAILED(g_pDD->CreateSurface(&desc,&g_pPrimary,NULL)))
{
MessageBox(hwnd,"Couldn''t create Primary",NULL,NULL) ;
}
g_pPrimary->SetClipper(g_pddClipper);
DDSCAPS2 ddscaps;
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
if(FAILED(g_pPrimary->GetAttachedSurface(&ddscaps,&g_pBack)))
{
MessageBox(hwnd,"BackBuffer Not Attached",NULL,NULL) ;
}
thanks in advance
Prairie