I have only just fixed this problem, and it has been bugging me for the past few days now. I thought it would be a good idea to post on here just to let people know about this bug, if they ever run into it.
This is the loop() method of the guide:
private void loop() {
GL.createCapabilities();
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
while (!glfwWindowShouldClose(window)) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
}
The problem here is that the buffer is being cleared before it has a chance of getting rendered, causing nothing to show up when the user tries to render anything. The way to fix this bug is to just move the glClear() method call to below the glfwSwapBuffers() method call. So the code would look like this:
private void loop() {
GL.createCapabilities();
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
while (!glfwWindowShouldClose(window)) {
glfwSwapBuffers(window); // This line and the next are swapped
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwPollEvents();
}
}
It would also be great to see the code changed so that this bug does not exist in the guide!
Btw, first time poster here, does anyone know how to post an image? I couldn't figure it out
Any help would be greatly appreciated!