# Why are my texture coordinates always (0,0) in this shader?

What I'm trying to do is add my depth buffers values to my scene, ie. I'm trying to make objects closer to the camera darker and objects further away lighter. Which should be easy: just render the depth buffer to a texture, and then render the scene, multiplying each pixels colour by the colour value at the same coordinates in my depth-buffer texture...

Yet I don't know how to use coordinates for textures.

Or more like it's just failing. What's happening is that the vertex shader is only using the (0,0) coordinate of my texture, so the entire scene changes colour depending on what's there.

What I'm doing is this (the critical stuff from my render function):

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthTextureId);   //Binds the texture
box.render();    //Sets the viewing matrix and renders a test VBO


I guess that's the right way to bind a texture? Anyhoo, here's the vertex shader's important stuff:

out vec4 ShadowCoord;

void main() {
gl_Position = PMatrix * (VMatrix * MMatrix) * gl_Vertex;  //Projection view and model matrices
ShadowCoord = gl_MultiTexCoord0;    //something I kept seeing in examples, was hoping it would work.
}


It seems gl_MultiTexCoord0 is the problem? Maybe?

The frag shader sets the colour using this function:

vec4(texture2D(ShadowMap, ShadowCoord.st).x * vec3(Color), 1.0);


Where the ShadowMap is the sampler2D for the texture, and Color is the vertex's color...

So what am I missing? How come the coordinates are not changing from 0,0?