Battling stuttering in my 2D C++/OpenGL sport


I am constructing a 2D sport from scratch utilizing C++ and OpenGL, however I’ve run right into a irritating situation: a easy sprite shifting from left to proper often stutters. Monitoring down the trigger has been difficult. Is it my sport loop? OpenGL? My code? One thing else completely?

I do know there are various posts about stuttering, however I haven’t discovered any that present useful insights for my scenario (linux).

There are two form of stutter :

There are two kinds of stutter I am observing:

  • Mini bumps each few seconds: I believe this could be attributable to inaccuracies in my loop, presumably because of the accumulator resulting in occasional double updates.
  • Persistent shaking: Typically the sprite jitters left and proper for a number of seconds. That is the problem I most wish to repair or at the least perceive.

What I’ve tried

Recording the problem has been tough. Once I use OBS to seize it, the stutter typically disappears after I transfer the sport window or carry out different duties. I’ve additionally tried recording with my cellphone, however the stuttering is difficult to note within the footage (blur and focus).

I’ve uploaded the loop I exploit right here on GitHub. Which is the implementation of Tyler Glaiel.

My setup

  • OS: Archlinux (6.12.4-arch1-1)
  • GPU: ASUS GeForce DUAL GTX 1060 O6G

Steps I’ve taken so Far

  • Enabled VSync: No noticeable enchancment
  • Tried a number of sport loop implementations
  • Examined on Home windows (D3D11): Whereas it stutters much less, I desire to stay with OpenGL on Arch Linux and repair the problem.
  • Used interpolation on rendering: No change.
  • Examined on one other PC: I’ve different drawback like display tearing (I even have this on the present PC but it surely’s much less frequent)
  • Tried different languages: I experimented with C#, however the stuttering occurred there as nicely.
  • Used completely different libraries: To remove potential culprits, I examined with each GLFW and SDL.

What I’m Wanting For

I do not count on a miracle resolution, however I would respect any recommendations to assist me debug and determine the foundation trigger.

  • What can I strive subsequent?
  • How can I successfully debug this?
  • Ought to I simply settle for and ignore the stuttering for now?

Thanks upfront on your assist!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles