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();
// store the color directly
gl_FrontColor = gl_Color;
gl_FrontColor = vec4(gl_Color.rgb, 0.0);
}

View file

@ -67,7 +67,7 @@ void DeferredLightingEffect::render() {
const int VIEWPORT_WIDTH_INDEX = 2;
float sMin = viewport[VIEWPORT_X_INDEX] / (float)primaryFBO->width();
float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)primaryFBO->width();
if (Menu::getInstance()->getShadowsEnabled()) {
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, Application::getInstance()->getTextureCache()->getPrimaryDepthTextureID());

View file

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