From 0f2f4ee8f911197c3a36737f908c06c494fea0e5 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Mon, 20 May 2013 11:32:32 -0700 Subject: [PATCH] Add the discussed four lines to disable blending and enable backface culling. --- interface/src/VoxelSystem.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index a3796f68c1..d578bb3504 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -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);