I'm testing a simple game demo on different machines, one of them being 32bit windows XP SP3 that has never had a game loaded on it once. So its fairly untouched territory.
My game demo runs, but it very slowly. At first I put this down to simply the machine is old. However... (please bare with me with this circumstantial evidence)... I loaded a simple 2D game onto the machine (Cave Story) and that ran fine. I noticed that if I left Cave Story running in the background, then my game demo ran at full speed no problem. And of course when Cave Story was closed my game slowed down.
This seems like I'm missing something in my setup code that, without causing either program to crash, the Cave Story instance is providing that my game demo is benefiting from. Maybe it's enabling some resources that are not turned on by default? I should mention that my game demo runs at full speed on my PC where I develop, which is 64bit win7 with game hardware.
Here is the directX init code I'm using (lifted from a directX sample):
HRESULT SCEngine::initDirect3D(HWND hWnd)
{
if ((screenWidth == 0) || (screenHeight == 0)) return S_FALSE;
direct3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DCAPS9 d3dCaps;
direct3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps );
D3DDISPLAYMODE d3ddm;
direct3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
if( windowed == true )
{
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = d3ddm.Format;
}
else
{
d3dpp.Windowed = FALSE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferWidth = screenWidth;
d3dpp.BackBufferHeight = screenHeight;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
}
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
//d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Do NOT sync to vertical retrace
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; // Sync to vertical retrace
d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
direct3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3dDevice );
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ), (float)(screenWidth / screenHeight), 0.1f, 100.0f );
d3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
d3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
d3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
D3DXCreateSprite(d3dDevice, &d3dXSprite );
return S_OK;
}
Hopefully someone can tell me I'm missing something simple?