Now utilizing backface culling

This commit is contained in:
CobaltXII
2018-12-28 21:24:51 -05:00
parent 8411bba142
commit 20be7b5c1e

View File

@@ -104,6 +104,13 @@ int main(int argc, char** argv)
exit(5);
}
// Set up preliminaries for backface culling. Backface culling is a way to
// speed up rendering by culling triangles that face away from the viewer.
glCullFace(GL_BACK);
glFrontFace(GL_CW);
// Load the block texture array.
GLuint block_texture_array = mc_load_block_texture_array();
@@ -381,6 +388,10 @@ int main(int argc, char** argv)
glEnable(GL_DEPTH_TEST);
// Enable backface culling.
glEnable(GL_CULL_FACE);
// Bind the block shader program to the current state.
glUseProgram(block_shader_program);
@@ -426,6 +437,10 @@ int main(int argc, char** argv)
glUseProgram(0);
// Disable backface culling.
glDisable(GL_CULL_FACE);
// Disable depth testing.
glDisable(GL_DEPTH_TEST);