On Tue, Oct 20, 2009 at 04:09:44PM +0100, Robert Osfield wrote:
> Hi Linares,
> 
> I believe the issue you are up against is pretty common for single
> threaded multi-context applications, each swap buffers being issued in
> a different frame.  This behavior will vary across drivers so you may
> will see variations as you move your applications to different
> hardware/OS/drivers.
> 
> There is an OpenGL extension that supports syncronizing of swap
> buffers across multiple graphics contexts that allows you to assigns
> contexts to swap groups, the OSG itself doesn't utilize it, but you
> look into this.  I'm afraid I can't recall the name of the extension
> off the top of my head.
> 
> Robert.

from nVidia's README.txt,
-----
SWAP SYNC: Swap sync refers to the synchronization of buffer swaps of
multiple application windows. By means of swap sync, applications
running on multiple systems can synchronize the application buffer
swaps between all the systems.  In order to work across multiple
systems, swap sync requires that the systems are frame locked.

With the GLX_NV_swap_group extension, OpenGL applications can be
implemented to join a group of applications within a system for local
swap sync, and bind the group to a barrier for swap sync across a
frame lock group. A universal frame counter is also provided to
promote synchronization across applications.
-----

As far as I've read you have to have the additional sync hardware,
even for the single GPU, single display configuration.

Linares Antonin,
I did a quick look and I'm seeing everything required for
multi-threaded swap buffers in Qt.  It will depend on your
application, but here is one way to go about it.  The routines
makeCurrent, doneCurrent, swapBuffers are all member functions of the
QGLWidget class.

In each window call setAutoBufferSwap(false); to disable buffer
swapping when paintGL() is called.  Setup one thread per window, Qt
threads, pthreads, or OpenThreads, have them waiting in a barrier type
operation.  Each thread has one window, it loops with barrier,
makeCurrent, swapBuffers, doneCurrent.
Setup one timer.  In that timer callback, call each window updateGL
routine, or maybe it will just be better to call each makeCurrent(),
OSG frame(), doneCurrent().  If you want them to swap at the same time
you'll also want them all to draw at the same time, at least
definitely not in independent GUI timers.
Once each window is draw in the back buffers, release the threads,
wait until they've finished, then continue.


> On Tue, Oct 20, 2009 at 5:49 PM, Linares Antonin
> <antonin.lina...@onera.fr> wrote:
> > Hi David,
> >
> > The osgviewer run as you describe, 60 htz etch and I can also see the
> > tearing problem. (Quadro NVS 295)
> > I thinks it's a Qt related problem:
> > I use the viewerQT / adapterWidget from the osg exemple, so The paint
> > event is call by a Qtimer and force OSG to run in singleThread mode.
> > I dont know how call the swap buffer from different thread, by using a
> > osg::Thread or a Qthread ?? ?How can i call the SwapBuffer with OSG ?
> >
> >
> > Thanks !
> >
> >
> >
> > Le lundi 19 octobre 2009 ? 09:24 -0500, David Fries a ?crit :
> >> On Mon, Oct 19, 2009 at 11:29:32AM +0000, Linares Antonin wrote:
> >> > Hi,
> >> >
> >> > I actually use 2 osg::viewer embedded in a Qt window, when i enable the
> >> > sync to vblanc in nvidia-setting my 2 viewers work's to 30 fps while my
> >> > refresh rate is 60 htz. (and 3 viewers work's to 20fps ...)
> >> > Did anybody already experiment this issue ?
> >> > Maybe it's a driver bug, i use osg 2.8.0 with nvidia 180.29 under linux
> >> > RHEL 5.
> >> >
> >> > Thanks you all.
> >>
> >> What if you run
> >> osgviewer cessna.osg
> >> one, two, or three times? ?I would expect the same 60Hz, 30Hz, 20Hz.
> >> In my experience it is graphics card and driver dependent. ?I'm
> >> running an nVidia Quadro FX 3700 with driver 185.18.14 and the
> >> multiple osgviewers will each run at 60Hz, but beyond one it isn't
> >> always vertical synced as I can see tearing.
> >>
> >> I'm guessing the logic, but it seems that swap buffers doesn't return
> >> until the swap happens, or the swap happend for the previous swap
> >> buffers on that context. ?You could try multithreading your swap
> >> buffers calls, that way all threads are waiting for the swap to happen
> >> instead of one thread serially waiting on each context to swap.
> >>
> > --
> > ---
> > Linares Antonin
> > ONERA - DCSD
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
David Fries <da...@fries.net>
http://fries.net/~david/ (PGP encryption key available)
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to