Original Post
Hi all, I have just made a program that renders a terrain and water and spins the camera around. I have some funny/annoying issues on the framerate though. The one that really stumps me is this: when I run my program while running windows media player it runs around 60 fps but when I exit widows media player it runs around 43 fps. It makes no sense to me. Second is that, although it runs around 43-60 fps the camera seems to stick at a certain place for a brief moment about every second. This pause in the camera spinning happens every second, and it only seems to happen on the top half of the screen. The bottom seems to keep moving. BTW, someone said in another thread something about setting a present parameter called PresentationInterval which I haven't set. If this might be my problem, what value should I set it to. Finally, I am kinda trying to build my game like oblivion, and oblivion renders like 4 times as many polygons as I currently am, yet it runs around 50 fps on my machine. Is there something that I may be leaving out, or putting in that may be slowing my program? Thanks to all. EDIT oh, and if this helps, here is my source code for rendering
BOOL Render()
{
D3DXMATRIX matWorld;
int i;
if(FAILED(g_pD3DDevice->BeginScene()))
return FALSE;
if(FAILED(g_pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_RGBA(0,25,255,255), 1.0f, 0)))
return FALSE;
D3DXMatrixRotationX(&matRotX, -XAngle);
D3DXMatrixRotationY(&matRotY, (float)timeGetTime()/5000);
D3DXMatrixRotationZ(&matRotZ, -ZAngle);
D3DXMatrixTranslation(&matTrans, -XPos, -YPos, -ZPos);
D3DXMatrixIdentity(&matView);
D3DXMatrixMultiply(&matView, &matView, &matTrans);
D3DXMatrixMultiply(&matView, &matView, &matRotZ);
D3DXMatrixMultiply(&matView, &matView, &matRotY);
D3DXMatrixMultiply(&matView, &matView, &matRotX);
g_pD3DDevice->SetTransform(D3DTS_VIEW, &matView);
D3DXMatrixTranslation(&matWorld, 0.0f, 0.0f, 0.0f);
g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
g_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); //Neeed to remove
g_pD3DDevice->SetStreamSource(0, pD3DVB, 0, sizeof(sVertex));
g_pD3DDevice->SetFVF(VertexFVF);
g_pD3DDevice->SetMaterial(&pMat);
g_pD3DDevice->SetTexture(0, g_pTexture);
for(i=0;i<rows;i++)
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,i*(2*(columns+1)),columns*2);
g_pD3DDevice->SetStreamSource(0, pWD3DVB, 0, sizeof(sVertex));
g_pD3DDevice->SetMaterial(&pWMat);
g_pD3DDevice->SetTexture(0, NULL);
D3DXMatrixTranslation(&matWorld, XPos, waterHeight, ZPos);
g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
if(FAILED(g_pD3DDevice->EndScene()))
return FALSE;
if(FAILED(g_pD3DDevice->Present(NULL,NULL,NULL,NULL)))
return FALSE;
return TRUE;
}