Fix for deferred lighting on voxels.

This commit is contained in:
Andrzej Kapolka 2014-09-11 19:06:29 -07:00
parent 76728e4fb1
commit f954e4d7ea
3 changed files with 7 additions and 3 deletions

View file

@ -22,5 +22,5 @@ void main(void) {
gl_Position = ftransform(); gl_Position = ftransform();
// store the color directly // store the color directly
gl_FrontColor = gl_Color; gl_FrontColor = vec4(gl_Color.rgb, 0.0);
} }

View file

@ -1392,8 +1392,11 @@ void VoxelSystem::render() {
applyScaleAndBindProgram(texture); applyScaleAndBindProgram(texture);
// for performance, enable backface culling // for performance, enable backface culling and disable blending
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
} }
// draw voxels in 6 passes // draw voxels in 6 passes
@ -1435,6 +1438,7 @@ void VoxelSystem::render() {
PerformanceWarning warn(showWarnings, "render().. cleanup after glDrawRangeElementsEXT()..."); PerformanceWarning warn(showWarnings, "render().. cleanup after glDrawRangeElementsEXT()...");
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glEnable(GL_BLEND);
removeScaleAndReleaseProgram(texture); removeScaleAndReleaseProgram(texture);