Original Post
I am currently using multi-texturing to set the alpha value to a particular value based on distance. I do this by generating texture coordinates from the z distance.
glEnable( GL_TEXTURE_GEN_S );
glTexGend( GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
GLfloat texgen[] = {0.0, 0.0, -1/oglFarplane, 0.0};
glTexGenfv( GL_S, GL_EYE_PLANE, texgen );
glEnable( GL_TEXTURE_1D );
glBindTexture( GL_TEXTURE_1D, texHandle );
-- glTexEnv calls to specify combination rules
This all works fine but it prevents me from using alpha values elsewhere in my scene. What I would like to be able to do is to render a fullscreen quad and generate the texture coordinates using the current z buffer instead of the z distance of the texels in the quad.
Any ideas?
glEnable( GL_TEXTURE_GEN_S );
glTexGend( GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
GLfloat texgen[] = {0.0, 0.0, -1/oglFarplane, 0.0};
glTexGenfv( GL_S, GL_EYE_PLANE, texgen );
glEnable( GL_TEXTURE_1D );
glBindTexture( GL_TEXTURE_1D, texHandle );
-- glTexEnv calls to specify combination rules
This all works fine but it prevents me from using alpha values elsewhere in my scene. What I would like to be able to do is to render a fullscreen quad and generate the texture coordinates using the current z buffer instead of the z distance of the texels in the quad.
Any ideas?