Jump to content
  • Advertisement
Sign in to follow this  
Anddos

Enabling TexOut slows down rotation of the object..

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

when i enable the writing out txt function,the object seems to turn alot slowly why would it do that?, i am looping a vector size in the render function thats a type vector<char*>, would that be making the object rotate slower?

[Edited by - Anddos on September 2, 2010 10:29:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
Your txt out function is likely slowing down your application, as any code would. Some code is slower than others, but the key problem I think you are seeing is that your object rotation isn't correct.

To get proper motion, you need to make your logic based on time. Instead of writing "rotation += 2" you need to write "rotation += 2 * deltaTime" where deltaTime represents the change in time between when you last ran your update loop and now. You can calculate your time using many different function (clock, timeGetTime, QueryPerformanceCounter), and then you just make a simple adjustment at the top of the update loop.

currentTime = timeGetTime();
deltaTime = currentTime - lastTime;
lastTime = currentTime;

Then, anything that you move, you use the deltaTime in the equations. You should also take a look at Gaffer's Fix Your Timestep. More specifically, you will eventually want to look up Numerical Integration methods like Velocity Verlet and Runge-Kutta.

Share this post


Link to post
Share on other sites
hmm i notice that fps drops to like 33fps from 3000 with this in begin scene



for(size_t i=0; i<VecChars.size(); ++i)
{

SetRect(&rect, 300, 0 + i*FONT_HEIGHT, 800/2, 600/2);
dxfont->DrawTextA(NULL,
VecChars,
strlen(VecChars),
&rect,
NULL,//DT_CENTER | DT_VCENTER,
D3DCOLOR_ARGB(255, 255, 0, 0));


}




would it be better to have this in its own thread?

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!