Advertisement

Device problem

Started by June 15, 2002 04:20 AM
-1 comments, last by decebal 22 years, 5 months ago
Hello I''m building some libraries for game programing and I have a problem when my program runs it can''t create the Direct3d Device Interface, I''ve got this code
   
BOOL cGraphics::CreateD3D8()
{
	Shutdown();
	if((m_pD3D=Direct3DCreate8(D3D_SDK_VERSION))==NULL)
		return FALSE;
	return TRUE;
}

BOOL cGraphics::SetDisplayMode(BOOL Windowed,long Width,long Height)
{
	if(m_pD3D==NULL)
		return FALSE;
	if(Windowed==TRUE)
		if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&m_d3ddm)))
			return FALSE;
		if(Windowed==FALSE)
		{
			m_d3ddm.Width=Width;
			m_d3ddm.Height=Height;
			m_d3ddm.RefreshRate=0;
			m_d3ddm.Format=D3DFMT_R5G6B5;
		}
		return TRUE;
}
BOOL cGraphics::SetPresentation(BOOL Windowed)
{
	
	ZeroMemory(&m_d3dpp,sizeof(D3DPRESENT_PARAMETERS));
if(Windowed==TRUE)
{
	m_d3dpp.Windowed=TRUE;
	m_d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
	m_d3dpp.BackBufferFormat=m_d3ddm.Format;
	m_d3dpp.EnableAutoDepthStencil = FALSE;
}

if(Windowed==FALSE)
{
    m_d3dpp.Windowed=FALSE;
	m_d3dpp.SwapEffect=D3DSWAPEFFECT_FLIP;
	m_d3dpp.FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;
	m_d3dpp.FullScreen_PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
    m_d3dpp.BackBufferFormat=m_d3ddm.Format;
}

if(m_pD3D==NULL)
return FALSE;


return TRUE;
}

BOOL cGraphics::CreateDevice()
{
	if(FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,m_hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&m_d3dpp,&m_pD3DDevice)))
		return FALSE;
	
return TRUE;
}
  
After this I call Created3d8,SetdisplayMode,setpresenattion,createdevice But on the createdevice the dunction returns False Can somebody help me ? Mankind must put an end to war before war puts an end to mankind. John F. Kennedy
Mankind must put an end to war before war puts an end to mankind. John F. Kennedy

This topic is closed to new replies.

Advertisement