0

I use glGenFramebuffer, glBindFramebuffer and other related functions to create the Framebuffer Object(FBO) and I use the FBO to draw the off-screen data. Now my question is that I finish the mentioned steps inside QGLWidget and how can I draw the data in FBO back to QGLWidget? Thank you very much!

Hurricane
  • 31
  • 3

1 Answers1

0

Assuming you attached a color buffer to your framebuffer using

glFramebufferTexture2D( myfboID, GL_FRAMEBUFFER, GL_TEXTURE_2D, mytexID, 0);

Change the framebuffer to the widget by

glBindFrameBuffer(GL_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT);

Simply render a QUAD textured with the previous texture. You can simply render a quad from [-1,-1] to [1,1] and with the above texture bound, and texture coordinates would be [0.0,0.0] - [1.0,1.0].

Harish
  • 964
  • 6
  • 17