Advertisement

FPS and related questions

Started by January 22, 2003 05:40 AM
1 comment, last by Smash 22 years, 1 month ago
Hello, all ! I''m new person on NeHe, but I''m already impressed with this site. Cool, very usefull. English is not my native language, I hope you''ll excuse some funny mistakes in this text :-) So, questions about FPS. 1. How to display it correctly ? How to print a string exactly at the place I want ? I have looked through lesson 13, of course. Using glRasterPos2f(..) function seems a bit buggy. The string with fps shows in different places of the window for different window sizes. If to find correct parameters for glRasterPos2f(..) for 640x480 window and than create 1024x768 window the string with FPS will be displayed at another position. 2. How to display FPS without slowing down the app ? I have turned the VERT sync off at all, but FPS is still about ~60 (I have Athlon XP 2000+, GF2). The performance of all app is remarkably different when printing FPS and when not. Thanks to everybody !
About positioning...

It depends what corner is 0,0 - I think it''s lower left in the tutorial. If you wanted to place text in the lower left corner you could put it at 10,10 and it would stay there at any resolution. If you want text beginning at the center of the screen you should position it at width/2 and height/2.

If you want strings to display, say, about 10% the windows width from 0,0, then make the string print at 0.1*width... you get the idea.
Advertisement
Parameters to glRasterPos2f(float, float) are not exact screen coordinates where the string is to be printed.
The object coordinates presented by glRasterPos are treated just like those of a glVertex command. They are transformed by the current modelview and projection matrices and passed to the clipping stage.

So, giving exact screen coords to this routine has no sence ...

May be you have working example of valid FPS printing ?

This topic is closed to new replies.

Advertisement