Jump to content
  • Advertisement

Archived

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

Spiral

Nehe bitmap font problems

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

Using Nehe''s code i''ve made an FPS counter for my game. Now, if the fps goes greater than something like 250 (possibly 255, that''ld make sense) it displays "1.#J". Im passing a float to glPrint(), i''ve tried other numbers like unsigned ints, longs etc but all seem to produce the same result. Anyone else have this problem?

Share this post


Link to post
Share on other sites
Advertisement
And what does your print code look like? It should be:

glPrint("FPS: %d", fps);

Is that what you are doing? If so you should have no problems.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites
I said im passing a float, it looks like:

glPrint("FPS: %.2f", fps);

I''ve also tried using a double, still doesnt work.

Share this post


Link to post
Share on other sites
Why do you need a float for frames per second? Try it with integers and see if the problem goes away.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites
This is due to the fact that it is a list base. Displays 0 - 255 chars. Make sure you transform the into a string before trying to display it. Otherwise a it thinks it a literal.

sprintf(Buffer,"%d",fps);
glPrint(Buffer);

Which should resolve the issue.

Share this post


Link to post
Share on other sites
No, that doesnt work. This code inside glPrint(...) does that anyway:

  

char text[1024];
va_list ap;

va_start(ap, fmt);
vsprintf(text, fmt, ap);
va_end(ap);

Share this post


Link to post
Share on other sites
Try converting the variables that you are using to calculate the FPS to floats sooner. The problem may be that you are mixing variable types in the calculation, and that is causing the result to not be converted to the correct type soon enough.

jw

Share this post


Link to post
Share on other sites
I''ve fixed it now. You were right, jwace, my variable types for calculating the FPS weren''t big enough

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!