I've recently made another project on OpenGL-ES for ARM with LWJGL. And I am using GLFW now (I was previously using EGL rendering with no issue)
But I noticed noticeable stuttering in my program. I investigated it and found that every 4th cycle of my main loop - glfwSwapBuffers(window) takes A LOT longer than in other cycles. We are talking of the difference between 0.0003 seconds and 0.28 seconds.
I have no idea what caused this. As you can see from the code (below), I am explicitly testing the time it takes swapBuffers to work. I can guarantee that the rest of my program (which is extremely small BTW) doesn't really take that much time at all, and nothing should cause any issues. I think.
I'm using LWJGUI, which is also a first time for me, but I tested its performance and it seems like it's doing completely OK.
Vsync is off, but I think double-buffering is on.
Here's my loop:
Vector2i windowSize = context.getFramebufferSize();
glClearColor(1, 1, 1, 1);
glViewport(0, 0, windowSize.x, windowSize.y);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
double timeStart = System.nanoTime() / 1000_000_000.0;
double timeEnd = System.nanoTime() / 1000_000_000.0;
double delta = timeEnd - timeStart;
Here's the sample output (timings). notice that the dip happens exactly every 4th time.