Help: PBO + pbuffer problem

Started by
2 comments, last by gualaopo 18 years, 7 months ago
I want to do some image process with GPU. I use the PBO(pixel_buffer_object) to get the input stream image 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 see 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!!!!
Advertisement
code?

btw, unless you have a very good reason, favour using the framebuffer object extension over the pbuffer one, its 'better' in most cases
Quote:Original post by phantom
code?

btw, unless you have a very good reason, favour using the framebuffer object extension over the pbuffer one, its 'better' in most cases


//the PBO has been initialed beforevoid display(){    glClear(GL_COLOR_BUFFER_BIT);    glEnable(GL_TEXTURE_2D);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    img = getNextImage();//upload texture to GPU with PBO    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, texBuffer);>sizeX*img->sizeY*3, NULL, GL_STREAM_DRAW_ARB);    void *pboMemory = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_WRITE);    memcpy(pboMemory, img->data,img->sizeX*img->sizeY*3);    glBindTexture(GL_TEXTURE_RECTANGLE_NV,tex);    glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT);    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, img->sizeX, img->sizeY, GL_RGB, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));    glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);//render to pbuffer	    rt->BeginCapture ();    glDrawBuffer(GL_FRONT);    glBindTexture(GL_TEXTURE_RECTANGLE_NV,tex);    glBegin(GL_QUADS);    glTexCoord2f(0,       0); glVertex2f(-1, -1);    glTexCoord2f(0,    0); glVertex2f( 1, -1);    glTexCoord2f(0, 0); glVertex2f( 1,  1);    glTexCoord2f(0,   0); glVertex2f(-1, 1);    glEnd();    glDrawBuffer(GL_BACK);    rt->BindBuffer(WGL_FRONT_LEFT_ARB);    glBegin(GL_QUADS);    glTexCoord2f(0,       0); glVertex2f(-1, -1);    glTexCoord2f(1,    0); glVertex2f( 1, -1);    glTexCoord2f(1, 1); glVertex2f( 1,  1);    glTexCoord2f(0,   1); glVertex2f(-1, 1);    glEnd();    rt->EndCapture();    rt->BindBuffer(WGL_BACK_LEFT_ARB);    glBegin(GL_QUADS);    glTexCoord2f(0,       0); glVertex2f(-1, -1);    glTexCoord2f(1,    0); glVertex2f( 1, -1);    glTexCoord2f(1, 1); glVertex2f( 1,  1);    glTexCoord2f(0,  1); glVertex2f(-1, 1);    glEnd();}	


I used to do this with FPO,but get the same rusult!
need help!

This topic is closed to new replies.

Advertisement