Search code examples
javalwjglframe-rate

How to control the frame rate of my LWJGL window int LWJGL3?


I'm learning now LWJGL3, and I have a problem. I want to limit the frame rate of my window to 60 FPS, but I don't know how to do that in LWJGL3. In LWJGL2 which I used before I switched to LWJGL3 I call Display.sync(60); before calling Display.update();, but in LWJGL3 the Display class was replaced by window which controlled by the GLFW class. SO, which method replaced the Display.sync(int frame_rate); method?


Solution

  • You can enable V-sync with glSwapInterval(1); after you create your window which will limit the fps to your monitor's refresh rate.