Jump to content
  • Advertisement
Sign in to follow this  
MaxDemian

DirectX8 Present function error

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

Hi, I have a problem with IDirect3DDevice8::Present(). This function returns: D3DERR_INVALIDCALL I have done this:
BOOL aeGraphics::Init()
{
	if (m_hWnd==NULL)
	{
		return FALSE;
	}
	if(FAILED( m_pD3D = Direct3DCreate8(D3D_SDK_VERSION) ))
	{
		return FALSE;
	}

	m_d3dpp.BackBufferCount = 1;
	m_d3dpp.Windowed = m_Windowed;
	m_d3dpp.hDeviceWindow = m_hWnd;

	if(m_Windowed)
	{
		if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&m_d3ddm)))
			MessageError("Error video mode.");
		
		m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

		m_d3dpp.BackBufferFormat = m_d3ddm.Format;
	
		m_d3dpp.EnableAutoDepthStencil = TRUE;
		m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
	}
	else//Pantalla completa
	{
		m_d3dpp.BackBufferWidth   = m_Width;
		m_d3dpp.BackBufferHeight  = m_Height;

		for(int i=0;i<GetNumDisplayModes()-1;i++)
		{
			m_pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT,i,&m_d3ddm);
			if(CheckFormat(m_d3ddm.Format ,FALSE,m_HAL))
			{
				m_d3dpp.BackBufferFormat = m_d3ddm.Format;
				break;
			}
		}

		m_d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
		m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
		m_d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
	}

	if(FAILED( m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,		((m_HAL)?D3DDEVTYPE_HAL:D3DDEVTYPE_REF),m_hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,						&m_d3dpp,&m_pD3DDevice)))
	{
		MessageError("dvide error");
		return FALSE;
	}

	return TRUE;
}

BOOL aeGraphics::Display()
{
	HRESULT hr;
	hr = m_pD3DDevice->Present(NULL,NULL,m_hWnd,NULL);
	if(FAILED(hr))
	{
		switch(hr)
		{
		case D3DERR_INVALIDCALL:
			MessageError("Display: D3DERR_INVALIDCALL");
			break;
		case D3DERR_DEVICELOST:
			MessageError("Display: D3DERR_DEVICELOST");
			break;
		default:
			MessageError("Display: Error");
		}
		return FALSE;
	}
	else
		return TRUE;
}

and when I testing...
		pGraph->ClearDisplay(D3DCOLOR_RGBA(0,100,0,255));

		if(pGraph->BeginScene())
		{
			
			pGraph->EndScene();
		}
		

		pGraph->Display();//Error here

The GetLastError() Funtion return 1400 error :/ ClearDisplay works good when I try to draw a font is ok as well, but when i draw vertex it doesnt work :S

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!