Sign in to follow this  

Enabling TexOut slows down rotation of the object..

This topic is 2662 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
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[i],
strlen(VecChars[i]),
&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

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