can't do shadow mapping correctly

Hi all,

I’ve beening trying to do shadow mapping with glsl for a week, But I can’t get the correct scene. I guess if it’s because I didn’t render the depth to texture correctly. and to clamp the coordinates of pixel into [0, 1] for texture look-up, do Ineed to multiply biasMatrix first then divide w or should I divide w then multiply biasMatrix? and can someone provide sample codes that be be built and run? Tnanks.

Have u googled for something?
The first 2 hits gave me these which show u everything u need.

http://www.fabiensanglard.net/shadowmapping/index.php

thanks for attention. but yes, I have searched on the net for a while, either of tutorial you mentioned is using deprecated opengl api or I can’t build it in VS2012.

OK here is the link to a more modern shadow mapping implementation from chapter 7 of the book OpenGL 4 shading language cookbook
https://github.com/daw42/glslcookbook/tree/master/chapter07

Thanks, I’ll try that later.