Archived

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

the origin

timer

Recommended Posts

hi im searching a very simple timer for my simple opengl code (nehe lesson 10) the best way would be when you post the timer code (i hope only a few lines) and then please tell me where to put it in thanks

Share this post


Link to post
Share on other sites
check nehe''s tutorial on drawing lines (its a videogame)

that shows you how to build a timer and from that you can build counters of frame limiters

Share this post


Link to post
Share on other sites
i copyed all the timerstuff into my engine and i can compile it without any mistake but there changed nothing on 2 systems it has still other speeds

what can i do?

Share this post


Link to post
Share on other sites
quote:
the best way would be when you post the timer code (i hope only a few lines) and then please tell me where to put it in


The best way would not be to copy and paste someone else''s code. Look in the MSDN for information about timers, and you''ll learn how they work.

Frame limiting is a bit naughty though - you may be better off looking into QueryPerformanceCounter (google it if you are unfamiliar with it).

- Pete

Share this post


Link to post
Share on other sites
I presume your building a frame limter (this attempts to maintain the framerate consitency between your machine and faster ones).

Have you remembered to include the ''while'' clause from the WinMain loop, this is what actually controls the framerate.

p.s. if your running your program on a slower machine than the one you built it on the frame limiter wont work.

To compensate:

1) Re-compile your work on the slowest machine (and set the frame delay accordingly, the frame rate will be the same on the faster machine as with the slower machine)
2)Design the program to increase the players movement if a slower processor has been detected.

Share this post


Link to post
Share on other sites