Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: OpenGL, DevIL, C++, How to animate tilesheet?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Junior Member Newbie
    Join Date
    May 2016
    Quote Originally Posted by john_connor View Post
    you just need a clock
    then in your main loop, you only call update() and render IF enough time is passed since the last frame
    BUT: by default, vsync is on, which means your fps cant get over 60 (frequency of the monitor)
    only if you disable vsync, fps can go up to about 3000 or so ...

    Code :
    #define FPS_GOAL 60
    static double tnow(0), tlast(0), tframe(0);
    tnow = m_time.GetTime();    //
    tframe = tnow - tlast;
    if (tframe < 1.0 / FPS_GOAL)
    tlast = tnow;
    // update(tframe);
    // render();
    Yeah, that's what I thought. But where am I supposed to put it? I've never made my own clock so I have no idea what to do with it.
    Edit: I modified my loop a bit
    Last edited by PocketTNT; 05-23-2016 at 10:32 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts