Ave!
I worte a ShadowMapping demo some days ago that copied the contents of the depthbuffer to a depthtexture via glCopyTexSubImage2D and then projected that onto the scene.
That went fine, but the problem was that the shadowmaps resolution had to be smaller or equal to the size of the applications viewport.
So I decided to use PBuffers for offscreen-rendering, to avoid this limitation.I then wrote an PBuffer-class that works fine, and the scene gets correctly rendered to to the PBuffer.
But after the scene from the lights point-of-view is in the PBuffers framebuffer, I want to copy the depthcomponents of it to my depthtexture that’s needed for shadowmapping.But when doing this with glCopyTexSubImage2D I don’t get a correct shadow-texture.
So could someone please take a look at these screenshots and tell me what I’ve done wrong ?
The scene from the viewers point-of-view : http://www.delphigl.de/misc/pbuffer3.jpg
The scene from the lights point-of-view rendered to the PBuffer : http://www.delphigl.de/misc/pbuffer1.jpg
And the depthtexture after getting the depthcomponents of the PBuffer : http://www.delphigl.de/misc/pbuffer2.jpg
So something must have gone wrong, as the texture even is wrong when I copy the contents of the PBuffers framebuffer instead its depthvalues.