Original Post
I can setup Direct3D with no errors and render a triangle, but when I call Clear, Drawprimitive, then Flip, after rendering one object previously, it reverts to a black screen. Calling Flip before clear AND after EndScene sometimes works, but not always.
I set up my surfaces like such:
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS / DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE / DDSCAPS_FLIP / DDSCAPS_COMPLEX / DDSCAPS_3DDEVICE;
ddsd.dwBackBufferCount = 1;
hr = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL);
if(FAILED(hr))
{
REGISTER_FAILURE("Create Primary Surface");
return FALSE;
}
//ZeroMemory(&ddscaps, sizeof(ddscaps));
//ddscaps.dwCaps = DDSCAPS_BACKBUFFER/* / DDSCAPS_3DDEVICE / DDSCAPS_COMPLEX*/;
DDSCAPS2 ddscaps = { DDSCAPS_BACKBUFFER, 0, 0, 0 };
hr = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &g_pDDSBack);
if(FAILED(hr))
{
REGISTER_FAILURE("GetAttachedSurface");
return FALSE;
}
and when I call CreateDevice, I use g_pDDSBack like such:
hr = g_pD3D->CreateDevice(IID_IDirect3DHALDevice, g_pDDSBack, &g_pd3dDevice);
and Ive tried even making sure of this by calling SetRenderTarget with g_pDDSBack.
With animation, my render function will actually display a frame of the triangle rotating evry 40 of so frames.
Anyone have any idea on whats going wrong?
Shaw Mishrak