PDA

View Full Version : HELP: PBO + pbuffer Problem!!



Gangban
08-29-2005, 09:27 PM
I want to do some video process with GPU. I use the PBO(pixel_buffer_object) to get the input stream date from the video_capture device. It's done. Then I need to do some ping-pong operation in pbuffer,but it doesn't work. I can only render the PBO to a single pbuffer,and then render the pbuffer to sceern.If I use the pbuffer's two surface(GL_BACK and GL_FRONT) to do ping-pong,it seemed that the texture data in PBO skip the pbuffer,and render to screen directly. I think the pbuffer configuration is right because the static texture instead of PBO works well.
can anybody help me ,thx!!!!

yooyo
08-30-2005, 01:15 AM
Im not sure what did you do, but following pseudocode might help:

1. Create PBO (big enough for input image)
2. Create texture that match input image size
3. Create two pbuffers or 2x FBO same size as texture
4. Copy incoming image to PBO. Use PBO data to copy image-data to texture object
5. activate pbuffer1 and render texture in it (screen aligned texture mapped quad)
6. loop N times (ping pong)
--- activate pbuffer2 (keep in mind that you may need to clear it's background/depth after activation)
--- bind pbuffer1 as texture
--- render texture to active pbuffer with some calculations
--- deactivate pbuffer2
--- exchange pbuffers (tmp = pbuffer1; pbuffer1 = pbuffer2; pbuffer2 = tmp)
7. Result is in pbuffer2

You can do this with FBO too, just replace pbuffers with FBO's.

yooyo

Gangban
09-01-2005, 05:40 PM
Originally posted by yooyo:
Im not sure what did you do, but following pseudocode might help:

1. Create PBO (big enough for input image)
2. Create texture that match input image size
3. Create two pbuffers or 2x FBO same size as .
......

yooyothx for your sugesstion.But I did do it this way.The data in PBO will skip the 2 pbuffers and render to screen directly. if I use only one pbuffer to do "PBO->PBUFFER->SCREEN",it works well. And " stati_texture->pbuffer1->pbuffer2->screen" is also all right

Gangban
09-01-2005, 05:42 PM
why :confused: