Archived

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

Compatibility issues...Can't Create Device!!

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

This graphics library I''ve made works fine on my computer but won''t work on friends. He gets the message(which I put in) Can''t select a monitor format of at least 16 bits.
// Try Loading 32 depth first 

	ZeroMemory(&m_d3dDisplayMode, sizeof(m_d3dDisplayMode));
	m_d3dDisplayMode.Format = CheckDisplayMode(m_Monitor.width, m_Monitor.height, 32);

	if(m_d3dDisplayMode.Format != D3DFMT_UNKNOWN)
	{
		//Width x Height x 32bit has been selected

		m_d3dDisplayMode.Width = m_Monitor.height;
		m_d3dDisplayMode.Height = m_Monitor.width;
		m_Error.DebugError("32x32 selected");
		m_Monitor.format = 32;
	}
	else
	{
		m_d3dDisplayMode.Format = CheckDisplayMode(m_Monitor.height, m_Monitor.width, 16);
		if(m_d3dDisplayMode.Format != D3DFMT_UNKNOWN)
		{
            //Width x Height x 16bit has been selected

			m_d3dDisplayMode.Width = m_Monitor.height;
			m_d3dDisplayMode.Height = m_Monitor.width;
			m_Error.DebugError("16x16 selected");
			m_Monitor.format = 16;
		}
        else
		{
			// ERROR LOG

			m_Error.DebugError( "Could not select a monitor format of at least 16 bits" );
			m_Error.TextError( "Could not select a monitor format of at least 16 bits" );

            return false;
        }
	}
Here is the function Check Display Mode
// Purpose: Check to see if the current resolution/depth is supported

// Post:	Returns the depth - or unknown format

D3DFORMAT Graphics::CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth)
{
	UINT x;
	

 	// Loop through different adapters

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

	return D3DFMT_UNKNOWN;
}
If anyone knows why...

Share this post


Link to post
Share on other sites
Just hard-code something like 800x600 at D3DFMT_X8R8G8B8 and see if it works. If the device creation fails, try a smaller bit depth, but if your buddy has anything recent in his system, it''ll work just fine. That''ll tell you if your buddy''s card will work or not. Otherwise, read up more on testing display modes. The SDK docs have some good code there. You might even check the sample programs. I think the main sample framework has this test in it somewhere.

Ryan Buhr
Reactor Interactive, LLC.
www.reactorinteractive.net

Share this post


Link to post
Share on other sites
Well honestly I don''t care if I can hardcode it in - I want to know why my test doesn''t work correctly maybe my logic is flawed or maybe I''m putting a wrong flag in here..hmm

This is making me mad

Share this post


Link to post
Share on other sites
Sorry for comming off snobby I was just a tad frusterated. Anyway I had him hardcode in D3DFMT_R5G6B5 to the format. So there is something wrong with my function not picking D3DFMT_R5G6B5 properly if anyone see''s it.

Share this post


Link to post
Share on other sites