Jump to content
  • Advertisement
Sign in to follow this  
Raxvan

dx 9 initialization problem

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

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;
	
	
	
}



Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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!