Original Post
I've just got my engine working, as you can proly see in a near by post, and I was wondering how I can optimize the Direct3D Init calls to use all the hardware each client has to offer.
Any specific tricks would also be welcome.
[edited by - Insodus on January 16, 2003 9:03:12 PM]
pD3D = Direct3DCreate8( D3D_SDK_VERSION );
if( pD3D == NULL) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error creating Direct3D object.");
}
D3DDISPLAYMODE d3ddm;
hRet = pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
if( FAILED( hRet ) ) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error getting display mode.", hRet);
}
pD3DCaps = new D3DCAPS8();
hRet = pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pD3DCaps );
if( FAILED( hRet ) ) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error getting device capabilities.", hRet);
}
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = Windowed;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.Flags = 0;
d3dpp.hDeviceWindow = main_window_handle;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = WINDOW_WIDTH;
d3dpp.BackBufferHeight = WINDOW_HEIGHT;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
switch(DefaultBitsPerPixel) {
case 16:
d3dpp.BackBufferFormat = D3DFMT_R5G6B5;
break;
case 24:
d3dpp.BackBufferFormat = D3DFMT_R8G8B8;
break;
case 32:
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
break;
}
hRet = pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, main_window_handle, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pD3DDevice );
if (FAILED(hRet)) {
MainErr->HandleError(__FILE__, __LINE__, CRITICAL, D3D_ERROR, "Error creating Direct3D object.", hRet);
}