Game Development Community

Detecting Color Depth

by Kyle Sluder · in Technical Issues · 08/11/2001 (7:18 pm) · 1 replies

Hey, everyone, I'm new here. :)

Why is it that there is no reference to color depth in any Direct3D8 documentation? On my machine, my Voodoo3 2000 card can only handle 16-bit color in a windowed Direct3D device, and my code initializes D3D before the library gets a chance to make the window fullscreen (and change the resolution to 640x480). How do I change the color depth to 16-bit color at run-time? Or better yet, how can I make sure the window initializes and takes over the screen before creating the D3DDevice (is that even possible)? Help, my chicken and egg problem is going to my head here...

Also, this is part of an engine package I'm developing called IsoEngine. IsoEngine is to DirectX as MFC is to WinAPI; basically it's a bunch of wrapper classes that allow you to create a functional app in very few lines. Here's what you have to write to make the app work:

CIsoEngineObject ioObj;
CIsoEngineWnd ioWnd;

ioWnd.CreateAndAttach(/*WNDCLASS name and window creation flags go here*/);
ioObj.CreateAndAttach(&ioWnd);

/*PeekMessage and translate/dispatch it
 *if it's WM_QUIT then break from the loop */
ioObj.Render();
/*Continue the loop until WM_QUIT is received*/

That's where my problem lies: ioWnd is created with a size of 640x480, and then ioObj is attached, which creates the D3D object. However, ioWnd is not fullscreen yet, and D3D fails with the message "No DDCREATEDRIVEROBJECT support in driver" because my card can't create a 32-bit D3D instance in windowed (desktop) mode.

SOMEONE HELP, PLEASE.

About the author

Recent Threads


#1
08/13/2001 (6:08 pm)
Taking a bit of a guess here, I've done a little DirectX so picking through a few help files and previous stuff I've done

D3DDISPLAYMODE d3ddm;
g_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = d3ddm.Format;
g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice );

will assign the current display mode to d3ddm. Hope this helps I'm not too familiar with Direct 3D (much better at OpenGL) but this hopefully will be able to provide you with the information to force the window to 16 bit if you can pull that out of d3ddm :)

This will have to modified but may work..

Owen