in my current porject I want to add Deffered Shading. To do this I created a pbuffer in which I have rendered my hole scene. Now I want a shader to change the color of each pixel in dependency of its distance to the lights and to the direction (normal) in dependency to the lights. But I dont know how to access the normals und the depth of the pbuffer. Here is an example how my porgramm works:
pbuffer::makecurrent()
scene::render()
here i dont know what to do
device::makecurrent()
render pbuffertexture prepared by shader()
If you’re actually doing deferred shading, then you should also be using FBOs. PBuffers only really allow you to render to a single texture at a time, which generally is not sufficient information to use deferred rendering (at a minimum, you need a normal buffer and a diffuse color buffer).
I found an example which only uses a pbuffer and a shaderprogramm which adds the normal and the depth to the color bits, while rendering. And the result is very good.