PDA

View Full Version : Timing reads from the framebuffer



Ferenzzy
10-29-2005, 04:54 AM
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!

jide
10-29-2005, 05:20 AM
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] ?

sqrt[-1]
10-29-2005, 05:20 AM
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.

Ferenzzy
10-29-2005, 05:59 AM
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.

sqrt[-1]
10-29-2005, 02:38 PM
Originally posted by jide:
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] ?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)

V-man
10-30-2005, 06:40 AM
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.