Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

fireking

direct 3d 8, cant create device

This topic is 5477 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

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
since you''re requesting full screen, you also need to specify the back buffer''s width and height.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!