Fog: Use depthbuffer.

This commit is contained in:
Vincent Lejeune 2014-01-27 19:31:03 +01:00
parent bc57d246e7
commit ecac127dd6
2 changed files with 3 additions and 3 deletions

View File

@ -15,9 +15,9 @@ out vec4 FragColor;
void main()
{
float z = texture(tex, uv).a;
float z = texture(tex, uv).x;
vec3 tmp = vec3(gl_TexCoord[0].xy, z);
vec3 tmp = vec3(uv, z);
tmp = tmp * 2.0 - 1.0;
vec4 xpos = vec4(tmp, 1.0);

View File

@ -567,7 +567,7 @@ void PostProcessing::renderFog(const core::vector3df &campos, const core::matrix
glUseProgram(FullScreenShader::FogShader::Program);
glBindVertexArray(FullScreenShader::FogShader::vao);
setTexture(0, static_cast<irr::video::COpenGLTexture*>(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH))->getOpenGLTextureName(), GL_NEAREST, GL_NEAREST);
setTexture(0, static_cast<irr::video::COpenGLFBOTexture*>(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH))->DepthBufferTexture, GL_NEAREST, GL_NEAREST);
FullScreenShader::FogShader::setUniforms(ipvmat, fogmax, startH, endH, start, end, col, campos, 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);