Timing reads from the framebuffer

Hi,

I am working on a blur effect using shaders. So I have to switch between reading from and writing to the framebuffer. But somehow the reading seems to occur before the rendering is finished. Do I really have to call glFinish before reading from the framebuffer? I thought in a squence like

  
glBegin(...);
   draw something
glEnd();
glCopyTexSubImage2D(...)

the copy process would start only after the drawing is complete. Am I wrong?

Thanks for your help!

Yes that should work. So either:
a) You are doing somthing wrong
b) There is a driver bug. (What card/driver/OS) If it is an ATI - just out of curiousity - ensure multisampling is disabled and see it it changes.

You really should to ensure GL has finished its work and that you can freely do whatever incomings you want.

Notes: are you sure glFinish is not essential here sqrt[-1] ?

It is a NVidia 7800 GTX using 76.76 driver for Linux. Multisampling is disabled. The bug occurs only if the window size is changed. The whole application is written with Gtk 2.4 and GtkGLExt. Appearently something isn’t working out if the Widgets size is changed. I would be great if any one has more suggestions. Thanks!

Note: Inserting glFinish before every read from the framebuffer didn’t change anything.

Originally posted by jide:
[b]You really should to ensure GL has finished its work and that you can freely do whatever incomings you want.

Notes: are you sure glFinish is not essential here sqrt[-1] ?[/b]
Yep, pretty sure. I do this stuff all the time. As far as I am aware glFinish is only really needed to sync rendering between tow threads or in single buffer applications. (could be wrong - I don’t recall ever using it)

I have used glFinish to avoid readback related bugs, but it was ages ago.
glFinish and glFlush are usually not needed.

glFinish can be used for testing GPU performance, but otherwise, I don’t see any use for it. You can use it to measure how long it took from sending the commands to rendering time.

2 rendering threads on one buffer? I don’t think so.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.