Enable depth test

This commit is contained in:
Kienan Stewart 2020-02-25 23:47:14 -05:00
parent aa441eefe7
commit 386a4488a4
1 changed files with 3 additions and 1 deletions

View File

@ -82,6 +82,8 @@ int main(int argc, char** argv)
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
float fov = 45.0; float fov = 45.0;
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
// Required before OpenGL Calls. // Required before OpenGL Calls.
GLuint vertex_array; GLuint vertex_array;
glGenVertexArrays(1, &vertex_array); glGenVertexArrays(1, &vertex_array);
@ -164,7 +166,7 @@ int main(int argc, char** argv)
// Clear GL buffers // Clear GL buffers
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Render game geometries // Render game geometries
glfwGetWindowSize(window, &window_width, &window_height); glfwGetWindowSize(window, &window_width, &window_height);