flicker tear on resize glfw private void tick() { // Always update inputs first…
- User
flicker tear on resize glfw
private void tick() { // Always update inputs first glfwPollEvents(); inputHandler.tick(); // Step mode (for debugging) if(!Main.debug) { // Tick the game based on the GameState stateHandler.tick(); // Reset deltas and key presses inputHandler.postTick(); } else { if(InputHandler.isKeyPressed(GLFW.GLFW_KEY_X)) { STEP_MODE = !STEP_MODE; inputHandler.postTick(); } if(!STEP_MODE || InputHandler.isKeyPressed(GLFW.GLFW_KEY_C)) { stateHandler.tick(); inputHandler.postTick(); } } } private void render() { glClearColor(1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); stateHandler.render(); printGLErrors(); glfwSwapBuffers(window); } - Assistant
Flickering or screen tearing on window resize with GLFW can occur due to various reasons. Here are some steps you can take to mitigate these issues:
-
VSYNC: Ensure that V-Sync is enabled. V-Sync synchronizes the frame rate with the monitor refresh rate, which can reduce tearing. You can enable V-Sync in GLFW using after creating the OpenGL context with GLFW.
-