I got this working by hacking the GameTutorials.com “Render to Texture” tutorial to render the depth buffer to the texture rather than the colour buffer. However, when I tried doing the same thing basing the program off of NeHe’s basic framework, it doesn’t work at all. Nothing appears to get rendered to the texture. . . Rather than just post a massive code sample, I’ve provided a link to the program, with source code. http://members.shaw.ca/dwkjo/Files/ShadowTest.zip
I’m using the ARB_depth_texture extension for depth texture formats.
BTW, you don’t have to allocate memory just to have a pointer to pass to glTexImage, you can just use NULL and it will still set the texture object and allocate the texture memory for that texture object.
Originally posted by Ostsol: Still not working. . . Rendering the colour buffer to the RGB texture doesn’t seem to work either. . . All I get is white.
Not sure why rendering RGB doesn’t work, but I’ve emailed you a “fixed” version of your “ShadowTest” program.