PDA

View Full Version : PBuffer Normal Color Depth Access



MoeTM
03-23-2011, 09:29 AM
Hi,

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()

I hope my question is understandable :)

Alfonse Reinheart
03-23-2011, 01:30 PM
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).

MoeTM
03-24-2011, 05:49 AM
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.