Add the discussed four lines to disable blending and enable backface culling.

This commit is contained in:
Andrzej Kapolka 2013-05-20 11:32:32 -07:00
parent 85bca558f5
commit 0f2f4ee8f9

View file

@ -638,11 +638,18 @@ void VoxelSystem::render() {
_perlinModulateProgram->bind();
glBindTexture(GL_TEXTURE_2D, _permutationNormalTextureID);
// for performance, disable blending and enable backface culling
glDisable(GL_BLEND);
glEnable(GL_CULL_FACE);
// draw the number of voxels we have
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vboIndicesID);
glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE);
glDrawElements(GL_TRIANGLES, 36 * _voxelsInReadArrays, GL_UNSIGNED_INT, 0);
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
_perlinModulateProgram->release();
glBindTexture(GL_TEXTURE_2D, 0);