Skip to main content
GameDev.net gamedev.net
🔒 Locked

sampler2DShadow combined with sampler2D

Started by pixienick Feb 20, 2009 at 6:14 AM 1 replies 3k views
Original Post
pixienick
pixienick
Hi I am having some difficulty getting a shadow map displayed on top of a normally textured object. It seems the shader just refuses to display both the texture and the shadow together despite doing either one fine. Could someone take a look at my frag shader and give me a reason why this would not be working? Any help much appreciated!
uniform sampler2D sTexture;
uniform sampler2DShadow shadowMap;

varying vec4 projCoord;
varying vec2 texCoord;
varying float LightIntensity;

void main ()
{
	
	vec3 color = texture2D(sTexture, texCoord).stp;
	
	color *= shadow2DProj(shadowMap, projCoord).r;
	
	color *= LightIntensity;

	gl_FragColor = vec4(color, 1.0);
}

V-man
V-man
I'm sure the shader is fine.

http://www.opengl.org/wiki/GLSL_:_common_mistakes#Binding_A_Texture
pixienick
pixienick
Thanks for the link. I figured it out after some pain. Needed to set the uniform sampler variables using 'glGetUniformLocationARB' after compilation of the shader program. Wasn't important for the other variables.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.