Jump to content
  • Advertisement

Archived

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

Matsy

FPS : is only 40!?!?!

This topic is 5274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello out there... I''m using DirectX 9.0 to render a sky dome. Right now my code is very basic. I''m using a tri fan for the top and a tri strip for the rest. I also am not even using lighting right now. I''m just rendering the unlit vertices with a blue diffuse degrade to simulate the sky for now. I''m taking it step by step. But I decided once I''ve come this far it might be good to add a FPS counter to my application. I''m calculating like this.
    FPS++;
    if ( timeGetTime() > oldTime + 1000 )
    {
        DisplayFPS = FPS;
        FPS = 0;
        oldTime = timeGetTime();
    }
 
And I stuck it directly in my render loop. Then I use D3DXFonts to display the text. All my list''s and fans are default buffer settings and I''m thinking this might be why im getting such slow results. Or am I just going about the whole thing the wrong way? Any help for the matter would be greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
1.) Use QueryPerformanceCounter / QueryPerformanceFrequency for timing. It''s much more accurate than timeGetTime().

2.) What, exactly, are you doing in your rendering loop? Post some code.

Share this post


Link to post
Share on other sites
OK... after switching my vertex buffer pooled settings to D3DPOOL_MANAGED. I now get 80 fps.... But i still think I sould get more!!! Is there anything else i should look at?

Share this post


Link to post
Share on other sites
and check i will check the QueryPerf funtion...

and well it''s split up into classes and hard to post. but... this is basically what happens at the root of each loop right now.

Please ignor variable names... this is a prototype...


void COberon::Update()
{

tmpCamera.Update();

if ( bNeedUpdate )
{
tmpFan.Update();
tmpStrip.Update();
tmpNormals.Update();
bNeedUpdate = false;
}
if ( bPause )
{
tmpFan.SetFillMode(D3DFILL_WIREFRAME);
tmpStrip.SetFillMode(D3DFILL_WIREFRAME);
}
else
{
tmpFan.SetFillMode(D3DFILL_SOLID);
tmpStrip.SetFillMode(D3DFILL_SOLID);
}

}

void COberon::Render()
{
tmpFan.Render();
tmpStrip.Render();

if ( bShowNormals )
{
tmpNormals.Render();
}

FPS++;
tmpFont.Write("FPS : %d", FPSDisplay);

if ( timeGetTime() > oldTime + 1000)
{
FPSDisplay = FPS;
FPS = 0;
oldTime = timeGetTime();
}
}


Does this help?

Share this post


Link to post
Share on other sites
Note : that originally the pause flag was to top it from spinning ect... but i used it to toggle wire later cause it was there already.

Share this post


Link to post
Share on other sites
And after getting 80 FPS... I changed nothing and it went back to 50. hrmmm... HELP!!! hehehe

Share this post


Link to post
Share on other sites
I meant to post your RENDERING code...as in your calls to draw primitive and the like

Share this post


Link to post
Share on other sites
lol... oh ok...

sorry...

void CC3DTriangleFan::Render()
{
//Has the vertex buffer been setup?
if ( m_d3dvbVertexBuffer )
{
//If so draw it
m_lpd3dDevRef->SetStreamSource(0, m_d3dvbVertexBuffer, 0, sizeof(CC3DVertex));
m_lpd3dDevRef->SetFVF(D3DFVF_C3DVERTEX);
m_lpd3dDevRef->SetRenderState(D3DRS_LIGHTING, m_bUseLighting);
m_lpd3dDevRef->SetRenderState(D3DRS_FILLMODE, m_dwFillMode);
m_lpd3dDevRef->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, m_lSegmentCount - 2);
m_lpd3dDevRef->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
m_lpd3dDevRef->SetRenderState(D3DRS_LIGHTING, true);
}
}

void CC3DTriangleStrip::Render()
{
//Has the vertex buffer been setup?
if ( m_d3dvbVertexBuffer )
{
//If so draw it
m_lpd3dDevRef->SetStreamSource(0, m_d3dvbVertexBuffer, 0, sizeof(CC3DVertex));
m_lpd3dDevRef->SetFVF(D3DFVF_C3DVERTEX);
m_lpd3dDevRef->SetRenderState(D3DRS_LIGHTING, m_bUseLighting);
m_lpd3dDevRef->SetRenderState(D3DRS_FILLMODE, m_dwFillMode);
m_lpd3dDevRef->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, m_lSegmentCount - 2);
m_lpd3dDevRef->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
m_lpd3dDevRef->SetRenderState(D3DRS_LIGHTING, true);
}
}


i this what you mean?

Share this post


Link to post
Share on other sites
Please stop double, triple, and quadruple posting in your replies. You seem to do it a lot in the threads you post in. There is an edit button for a reason -- don''t post 4 times in a row.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!