Why does my application hang when using a render loop?

Started by swimerok, October 27, 2021, 07:30:32

Previous topic - Next topic

swimerok

I made a mini-application in Java LWJGL and made a loop for rendering, but the trouble is: the window just freezes, and if you hover the bear, the bear icon will change to loading. Here is the code:
protected void gameLoop() {
    while(!window.windowShouldClose()){
        // TODO: UPDATE
        Renderer.getInstance().render();
    }
}



(Renderer#render())
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glClearColor(43f / 255f, 43f / 255f, 43f / 255f, 0f);
glfwPollEvents();
for (IRenderable render : objects){
        render.render();
}
glDisable(GL_TEXTURE_2D);


and yes, if I do not call gameLoop then the window opens and immediately closes