I've been learning DirectX over the last few days, and I seem to be having a problem with the Clear method for clearing the backbuffer:
bool Draw()
{
//clear the scene
if (d3ddev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0, 0, 100), 1.0f, 0) == D3DERR_INVALIDCALL)
return false;
d3ddev->ColorFill(backbuffer, NULL, D3DCOLOR_XRGB(0, 0, 100));
...
return true;
}
d3ddev is of type LPDIRECT3DDEVICE9 and otherwise works fine - if I comment out the d3d->Clear(...) line the rest will function as intended, no other issues elsewhere in the code (ColorFill will run and fill the screen dark blue, which seems to achieve the same effect). Curious as to why Clear doesn't work though. Any ideas?