Advertisement Jump to content
Sign in to follow this  

A problem of Shadow map

This topic is 3843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I use Shadow map to render a shadow.The picture which I get in the last have many incorrect texture, but the shadow is correct. Here is my attributes with the shadow texture: glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32_ARB, shadowMapSize, shadowMapSize, 0,GL_DEPTH_COMPONENT32_ARB, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ...... glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT32_ARB,0,0,shadowMapSize,shadowMapSize,0); ...... glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, textureMatrix); glEnable(GL_TEXTURE_GEN_S); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_T, GL_EYE_PLANE, textureMatrix+4); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_R, GL_EYE_PLANE, textureMatrix+8); glEnable(GL_TEXTURE_GEN_R); glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_Q, GL_EYE_PLANE, textureMatrix+12); glEnable(GL_TEXTURE_GEN_Q); ...... glEnable(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); I hope someone can tell me which place I have a mistake. P.S.: As a new , I want to know how to clip a picture in this forums.

Share this post

Link to post
Share on other sites

dunno which incorrectness you get - but I presume it's biasing problem (the most common). Just do some polygon offsetting, when you're rendering texture (example values from me are 4.0f and 2.0f ... for more information about polygon offset - ):

glPolygonOffset(4.0f, 2.0f);

About images - just upload them to imageshack and use <.a href.> and <./a.> (without periods), or <.img src="".> (without periods of course) to show image here - surely post it, because it might be another problem.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!