Sign in to follow this  

Scene Rendering and FPS

This topic is 4815 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

Hi, I have a question about FPS in the scene rendering. this is my frame function, when I take out the render method the FPS jump up to the millions. when I do the scene rendering it drops down to 30. Is that expected. I'm not even doing any rendering just clearing the target and zbuffer, begin scene, end scene and present. Any comments would be appreciated, thanks.
bool Frame(){

	startTime = timeGetTime();

	app.display.Render();

	FPS++;

	endTime = timeGetTime();

	Duration += endTime - startTime;

	if(Duration >= 1000){

		Duration = 0;

		char buf[256];

		sprintf(buf, "FPS=%d", FPS);

		app.window.SetTitle(buf);

		FPS = 0;

	}

	return true;
}

bool XDisplayManager::Render(){

	m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
						m_BgColor, 1.0f, 0);

	m_pD3DDevice->BeginScene();

	m_pD3DDevice->EndScene();

	m_pD3DDevice->Present(NULL, NULL, NULL, NULL);

	return true;

}


Share this post


Link to post
Share on other sites
Well, since the render stuff is takes the blunt of the time if you have v-sync enabled (means it has to wait for the monitor to refresh before drawing the backbuffer to the front buffer)!, which I'm guessing you do; taking it out allows everything do be done without the delay. Which makes it run really fast.

Share this post


Link to post
Share on other sites
As I remember the defaults are driver-specific.

When you set up your device, in the D3DPRESENT_PARAMETERS, specify

D3DPRESENT_PARAMETERS.SwapEffect = D3DSWAPEFFECT_COPY;

That should work.

Share this post


Link to post
Share on other sites
Set present params presentinterval to D3DPRESENTINTERVAL_ONE when creating or reseting your device for vsync.

For non-vsync use D3DPRESENTINTERVAL_IMMEDIATE. I also tend to use SWAPEFFECT_DISCARD.

I doubt that 30Hz is vsync though, if all you're doing is clearing... unless you set the present interval to two, or the rest of your app is taking too long to run.

Share this post


Link to post
Share on other sites
I put a SUCCEEDED around the clear and begin scene and that doubled my FPS. And I tried D3DPRESENT_INTERVAL_IMMEDIATE and that doubled it again so now Im getting 170 FPS, thanks alot guys.

Share this post


Link to post
Share on other sites

This topic is 4815 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this