PDA

View Full Version : how to compose two images according to their zbuffer values?



lgnnn
05-26-2003, 06:22 PM
i have got two images's RGB and their zbuffer values with glReadPixel.now i want to compose them together by comparision of zbuffer values. if i do it pixel by pixel, i'm afraid it will cost a lot time. i also want to reach 20 frames per second. who can give some suggestion on it? thanks

hkyProgrammer88
05-28-2003, 11:36 AM
Hello,

So you have two images and zbuffer values that you got by glReadPixel, then you wish to put them together again.

One problem I see is that glReadPixel is slow. I am guessing that you produced both images by OpenGL rendering. So why not render the first image into one buffer, then display that buffer, and render the second image in another buffer and display that, then it you want them combined, then render the second onto the first, or the first onto the second.

Just a few questions,
1. Must you be able to show both images independantly at anytime?
2. Are both images produced by some rendering method which is must faster then glReadPixel of an entire image?
3. After reading the images in (glReadPixel) do you modify the color or zbuffer data?