Enabled GL Deph buffor so things render in correct order.
This commit is contained in:
parent
53da829dbe
commit
1b82ef0556
1 changed files with 5 additions and 1 deletions
|
|
@ -184,8 +184,13 @@ int main(int argc, char **argv) {
|
||||||
glm::mat4 Projection = glm::perspective(
|
glm::mat4 Projection = glm::perspective(
|
||||||
glm::radians(45.0f), (float)width / (float)height, 0.1f, 100.0f);
|
glm::radians(45.0f), (float)width / (float)height, 0.1f, 100.0f);
|
||||||
|
|
||||||
|
// Create player camera object
|
||||||
PlayerCamera camera;
|
PlayerCamera camera;
|
||||||
|
|
||||||
|
// Enable Render order things don't render in front of the wrong objects
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// Game loop
|
// Game loop
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
|
|
@ -200,7 +205,6 @@ int main(int argc, char **argv) {
|
||||||
camera.tick();
|
camera.tick();
|
||||||
|
|
||||||
// Clear screen ready for next loop
|
// Clear screen ready for next loop
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
// Make every shader/rendering call from this point on use our shader
|
// Make every shader/rendering call from this point on use our shader
|
||||||
// glUseProgram(shaderProgram);
|
// glUseProgram(shaderProgram);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue