Original Post
Hi I got shadow mapping without textures working with GLSL, but now im in problems again, im trying to do it with textures... Im using GL_TEXTURE_ARB0 for the normal texures and GL_TEXTURE_ARB1 for the shadow map textures. Here the vertex and frag shaders. Vertex: varying vec4 ProjShadow; void main(void) { ProjShadow = gl_TextureMatrix[1] * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = ftransform(); } Frag: uniform sampler2DShadow ShadowMap; varying vec4 ProjShadow; uniform sampler2D texture0; uniform sampler2D texture1; void main (void) { //vec3 color = vec3(1.0, 1.0, 1.0); //color *= shadow2DProj(ShadowMap, ProjShadow).r; //gl_FragColor = vec4(color, 0.0); gl_FragColor = texture2D(texture2, gl_TexCoord[0].xy) * shadow2DProj(ShadowMap, ProjShadow).r; } Im setting texture0 an 1 with glGetUniformLocationARB with their correponding textures. At the i end i see the escene with normal textures and no shadow map, if i comment the normal textures and uncoment the lines from the frag shader it works ( with some artifacts but works :-) ). And there some extrange things, if let the normal textures uncomment and use and activate this frag shader for all the execution time vec3 color = vec3(1.0, 1.0, 1.0); color *= shadow2DProj(ShadowMap, ProjShadow).r; gl_FragColor = vec4(color, 0.0); i can see the escene with one normal texture doing extrange things. Maybe i have an error with glActiveTextures but all im doing is activate it, binding it and deactivate it before it corresponding glBegin/glEnd, same for shadow mapping texture. Any ideas? Thanks in advance.