hello guys,

i’m trying to debug a problem i met while implementing the shadow map method.

i first render the scene from the light source. and save the depth map onto a texture.

and then, i write a second pass, use the modelview matrix and the projection matrix from the first pass to find the texture coordinate of a vertex on the shadow map.

the problem is that i cannot pass the matrices from the first pass to the glsl shader of the second pass properly.

i striped down my program and did some simple tests:

here is the vertex shader:

```
void main()
{
gl_Position=ftransform();
}
```

now if i set the modelview and projection matrix with gluPerspective and gluLookAt, everything renders fine.

i can also change the ftransform to gl_ProjectionMatrix*gl_ModelViewMatrix*gl_Vertex; , everything is still working.

however, if i pass the modelview matrix and projection matrix to two uniform mat4 variables i defined in the shader, then the rendering becomes wrong, i can’t see anything.

```
uniform mat4 modelview;
uniform mat4 projection;
void main()
{
gl_Position=projection*modelview*gl_Vertex;
}
```

i’m sure that the uniform location ids are all valid. they are 1 and 0 in my program.

and this is how i get the two matrices inside my c++ program and pass them to the shader:

```
glUseProgram(secondpass);
glGetFloatv(GL_MODELVIEW_MATRIX,tmodelview);
glGetFloatv(GL_PROJECTION_MATRIX,tprojection);
glUniformMatrix4fv(modelviewUniform,1,GL_FALSE,tmodelview);
glUniformMatrix4fv(projectionUniform,1,GL_FALSE,tprojection);
```

my self-defined matrices should have the same values as those in the gl_ProjectionMatrix and the gl_ModelViewMatrix, because i just acquired them from the opengl context before passing them to the shader.

I am working under ubuntu 10.10 with nvidia 8800GTX. I have stuck on this for two days, can’t figure out why.

thank you for your help.