leif
leif copied to clipboard
glClearColor in the documentation
The documentation mentions the following code:
while(!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
}
glClear clears the color buffer to the color configured with glClearColor, so constantly setting it after clearing is incorrect.
It means your very first frame will actually be just black. After that every frame after you're changing the color value to the same value, which basically only costs time and does nothing. glClearColor should be called only once outside of the loop.