View Full Version : Depth light/shadow map

02-09-2007, 11:53 PM
Hi all.

I'm trying to do the shadow/light map for my OpenGL scene using render to texture..

What function/code to get the grayscale depth render? I bump into it last time - at that moment I'm still learning on how to set up OpenGL. Can't find it now. Maybe I'm googling for with a wrong keywords.

Please help me.. Thank you.

02-10-2007, 02:47 AM
You're using the ARB_depth_texture/ARB_shadow extensions, and you want to view the depthmap for debugging purposes?

You can read all the gory details in the registry:

Or you could break out the spec (equally gory), since these were made part of the core in version 1.4:
(See the table in section 3.8.4, p. 168.)

I think you're basically looking for something like this:

glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
...Then you should be able to use your depthmap as a greyscale texture.

Hope it helps.

02-10-2007, 03:04 AM
Also be aware that sometimes depthmaps can appear to be a solid color, due to the way depth values are mapped into texture (screen) space and the overall z range of your scene w.r.t. the camera (light source). You really need a pretty quick change in z to discern your shapes sometimes. Kinda freaked me out the first time...

02-10-2007, 03:34 AM
looking on it... thanks caveman... :)