Skip to main content
GameDev.net gamedev.net
🔒 Locked

dx 9 initialization problem

Started by Raxvan Aug 24, 2005 at 4:11 AM 0 replies 700+ views
Original Post
Raxvan
Raxvan
I started learning directx 8 and now i am learning dx 9 but i have a problem with the initialization. i wanted to transfer the initialization from dx8 to my code and i realize that 2 functions don't work : g_Direct3D->GetAdapterModeCount(0) g_Direct3D->EnumAdapterModes(0, x, &d3ddm); the functions are integrated in a function that checks for display mode g_Direct3D->GetAdapterModeCount(0) takes 2 parameters and g_Direct3D->EnumAdapterModes(0, x, &d3ddm); takes 4 parameters help!; tnx

D3DFORMAT CGame::CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth)
{
	UINT x;
	D3DDISPLAYMODE d3ddm;

	for(x = 0; x < g_Direct3D->GetAdapterModeCount(0); x++)
	{
		g_Direct3D->EnumAdapterModes(0, x, &d3ddm);
		if(d3ddm.Width == nWidth)
		{
			if(d3ddm.Height == nHeight)
			{
				if((d3ddm.Format == D3DFMT_R5G6B5) || (d3ddm.Format == D3DFMT_X1R5G5B5) || (d3ddm.Format == D3DFMT_X4R4G4B4))
				{
					if(nDepth == 16)
					{
						return d3ddm.Format;
					}
				}
				else if((d3ddm.Format == D3DFMT_R8G8B8) || (d3ddm.Format == D3DFMT_X8R8G8B8))
				{
					if(nDepth == 32)
					{
						return d3ddm.Format;
					}
				}
			}
		}
	}

	return D3DFMT_UNKNOWN;
	
	
	
}



Illco
Illco
Use the documentation that came with the SDK -- that's what it is for. The two function descriptions are:
UINT GetAdapterModeCount(          UINT Adapter,    D3DFORMAT Format);

and
HRESULT EnumAdapterModes(          UINT Adapter,    D3DFORMAT Format,    UINT Mode,    D3DDISPLAYMODE* pMode);

So you must call them differently and supply the right parameters. You can look in one of the SDK samples (I think it is called EnumDevice or other) to see how to suply these.

Greetz,

Illco

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.