Jump to content
  • Advertisement
Sign in to follow this  
FlashManiac

[.net] Framerate change in MDX

This topic is 3781 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, I have project in Managed DX, I draw some sprites and 3D objects and I need to render it in 30fps. But when I use onFrameMove(or onFrameRender) method frame rate is same as my refresh rate of my LCD display.. I didn't find any help for changing.. so could you avise me how I can change that framerate? thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by FlashManiac
Hello,
I have project in Managed DX,...

Why? MDX is dead. [wink]

Quote:
Original post by FlashManiac
I draw some sprites and 3D objects and I need to render it in 30fps.

Why?

Share this post


Link to post
Share on other sites
Quote:
Original post by Machaira
Quote:
Original post by FlashManiac
Hello,
I have project in Managed DX,...

Why? MDX is dead. [wink]

Quote:
Original post by FlashManiac
I draw some sprites and 3D objects and I need to render it in 30fps.

Why?


Because I NEED it. That's why!

Share this post


Link to post
Share on other sites
Your frame rate should be the refresh rate of your monitor because you should have PresentParameters.PresentationInterval = PresentInterval.One set. This is the setting you should have it at to prevent screen ripping.

Your animation should be calculated based on elapsed time using a timer instead of calculated per (render) frame.

Share this post


Link to post
Share on other sites
Check out Chad Vernon's Timing and Frames Per Second tutorial. It has a timer class which you can use for animation.

I use it like so

public void OnUpdateFrame(Device device, float elapsedTime)
{
m_lastFrameUpdate += elapsedTime;

if (m_lastFrameUpdate >= m_interval)
{
m_currentFrame = (m_currentFrame == m_numFrames - 1) ? 0 : m_currentFrame + 1;
m_lastFrameUpdate = 0;
}
}


m_currentFrame is the current frame in the animation, m_numFrames is the total number of frames and m_interval is time between each frame. This will ensure your animation will look the same no matter what FPS your getting.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!