Hi all,
I've built a very basic engine & game (not really a game yet) in Java to learn OpenGL. I didn't use C++ as I wanted to learn one thing at a time & I'm already very comfortable with Java.
I've used LWJGL just as an OpenGL wrapper, I've not used anything else it offers - I wanted to learn & write everything from first principals.
Anyway, it's a very simple game loop that renders a single square which bounces around the screen linearly. Clicking in the window will create another square with a random size/colour/velocity at the cursor location.
Now to my question, I observed that every now and again the square has some serious jitter for a few seconds - looks like frames skipping or something.
Also, generally, the square does not seem to move very smoothly, even though it's running at 60 FPS - increasing this does not seem to improve things.
What I've found;
- Whether I have one square or 200 squares the performance remains constant and the problems still exist. The issue is as obvious with one as it is with many.
- There are no obvious memory leaks or CPU issues - I attached a profiler, everything looks OK.
- It's not GC - again, I can see this in the profiler. I experience jitter GC is not occurring, so I can rule that out too.
I recorded a video to demonstrate the issue (it can be clearly seen at 16 seconds): https://github.com/arrwhidev/opengl-game/blob/master/jitter.mov
The code is on GitHub and pretty easy to run, details in README: https://github.com/arrwhidev/opengl-game
Any ideas where to start? Any clues/ideas?
Many thanks!