BOOL DoInit()
{
if((d3d=Direct3DCreate8(D3D_SDK_VERSION))==NULL)
return FALSE;
D3DDISPLAYMODE dispmode;
dispmode.Width=1024;
dispmode.Height=768;
dispmode.RefreshRate=0;
dispmode.Format=D3DFMT_A8R8G8B8;
//if(FAILED(d3d->CheckDeviceType(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,dispmode.Format,dispmode.Format,FALSE)))
//{
// AppError(TRUE,"Cannot initialize in X8G8R8B8 Color Mode...");
// return FALSE;
//}
//if(FAILED(d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&dispmode)))
//{
// AppError(TRUE,"Cannot initialize this display mode in window mode...");
// return FALSE;
//}
D3DPRESENT_PARAMETERS present;
ZeroMemory(&present,sizeof(D3DPRESENT_PARAMETERS));
present.Windowed=FALSE;
present.SwapEffect=D3DSWAPEFFECT_FLIP;
present.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;
present.FullScreen_PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
present.BackBufferFormat=dispmode.Format;
HRESULT val;
val=d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,g_hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&present,&card);
char *poo;
switch(val)
{
case D3DERR_INVALIDCALL:
poo="invalid call";
break;
case D3DERR_NOTAVAILABLE:
poo="not available";
break;
}
AppError(TRUE,poo);
return TRUE;
}
it goes to "invalid call"
i have a geforce 4 igp, so you cant tell me that it wont accept the a8r8g8b8, i also tried x8r8g8b8..
what am i doing wrong, cuz this is the same code from within the book, and it errors out
direct 3d 8, cant create device
since you''re requesting full screen, you also need to specify the back buffer''s width and height.
Additionally, the debug Direct3D runtime will have told you WHY an invalid call error was returned...
--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP
--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement