View Full Version : Problem about rendering to depth texture

10-31-2004, 05:12 AM
Hi all:
I'm about to implement shadow mapping in my engine, so I began to play with depth texture recently. I've never touched it before, and I'm having some really weird problems now, one of which is:
I created a pbuffer at size of 1024*1024, and a texture with the same size. Then I cleared the pbuffer with depth value of 0.2, copyed its content to the texture, and then projected the texture to the objects in the world. what I got is like this:


As you can see, only part of the texture is filled with the assigned value(0.2), and if I make the program window larger, it becomes:


Looks like the region of the pbuffer's depth buffer which was cleared is related to the size of my main window, but I created the pbuffer with a separated rendering context, this shouldn't happen, I think. Any idea why?

Also, if I create the pbuffer/texture at size of 2048*2048, the region got cleared becomes relatively smaller(see below), shouldn't the whole depth buffer be cleared?


10-31-2004, 12:05 PM
i guess the clear call only clears what is within the viewport that was defined for the pbuffer
try calling glViewport with your pbuffer sizes before clearing it (or when initializing it..)

11-01-2004, 10:32 AM
I have had simillar problems on ATI hw and drivers..