Shadowmapping and PBuffers

I have a problem with shadowmapping and pbuffers
I made a shadow mapping program, and it works just fine
it renders the scene from the light point of view, in the frame buffer, and reads back the z values to a texture, in a second pass applying the texture projectively to render the scene, with the depth texture extension and depth comparison.

Now, i want to use this technique in a multipass method. Clearly i cant write intermediate textures in the frame buffer anymore, so i use a p buffer to render the intermediate texture. So i render the scene in the pbuffer. The scene is redered correctly (i can copytex to a regular texture and project the texture to the scene) but the z values ramain are unchanged (they all have the value of the glClearDepth) wheny copytexing to a texture. The pbuffer is set up correctly i think (with WGL_DEPTH_BITS_ARB of the pixel format set to 24).

anyone ?


We use this approach in some SDK examples without problems. Are you sure it’s not a bug in your code? Dealing with multiple contexts is often the problem for pbuffer rendering.

Thanks -

I already suspected the multiple contexts being the problem. So my fault then.
Another thingy, how easy will shadow mapping extend to shadow cube mapping ?

stupid me indead
i simply forgot the glEnable (GL_DEPTH_TEST); for the pbuffer context.

Maybe another thingy
i exported all the necessary tranformations to calc the tex coordinated to the texture matrix, tracked by a vertex program, and the vertex program alone is generating the texture coordinates. does this sound like a good idea ?
If u want to do shadow cubemaps, is this as simple (?) as generating the 6 textures and applying them in 1 pass ? Or am i oversee-ing some stuff here ?

i also notice a frame drop from 380 to 210 when using a pbuffer