Archived

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

Hedos

DisplayMode problem

Recommended Posts

Hedos    674
I want to use a function to check if the Display Mode can handle the color format, but I always obtain an error at compilation(I use Visual C++ 6.0): error C2664: ''CheckDeviceType'' : cannot convert parameter 3 from ''struct _D3DDISPLAYMODE *'' to ''enum _D3DFORMAT'' My code is: IDirect3D8 g_pD3D; D3DDISPLAYMODE d3ddm; if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,&d3ddm, &d3ddm, FALSE))) return FALSE; This code is from the book "Programming Role-Playing game with DirectX"

Share this post


Link to post
Share on other sites
TheAIDSVirus    122
The third and fourth parameters of the CheckDeviceType function specify the front and back buffer formats that you intend to test. You are sending a pointer to the entire display mode structure. Instead of:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,&d3ddm, &d3ddm, FALSE)))

Try:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,d3ddm.Format,d3ddm.Format, FALSE)))

That may not work considering I don''t know if you''ve initialized d3ddm. If not, then just specify specific formats that you want to check. For example:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,D3DFMT_X8R8G8B8,D3DFMT_X8R8G8B8, FALSE)))

For a list of display formats, look up D3DFORMAT in the MSDN.

----
AIDS

Share this post


Link to post
Share on other sites