CompositeViewer support: Difference between revisions

Line 248: Line 248:


=== Swap Buffers ===
=== Swap Buffers ===
OpenGL drivers have a FIFO, your app fills the fifo with tokens and
data, at the end of the frame you send in a swap buffers token and
this goes into the FIFO with everything else.  Normally the swap
buffers call itself doesn't block (although some implementations do
this), but the FIFO itself can only be cleared at the rate for one
swap buffers call per frame so it'll fill and once filled up it will
effectively block until previous frame was begun dispatching.  The
driver may allow several frames worth data in the fifo before block,
this is driver dependent, and also dependent on just how data you have
to pass to OpenGL- if you have massive models the CPU will be block on
the FIFO right on the same frame rather than more than one frame begin
backed in the FIFO.
The end result of this is simpler though - put vsync on, and your
frame loop will block and should iddle while its waiting for the FIFO
to begin accepting new data. <ref>https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg04323.html</ref>
The driver will be queuing up multiple frames in the FIFO, something it
The driver will be queuing up multiple frames in the FIFO, something it
does to help improve the framerate, but increases frame latency.
does to help improve the framerate, but increases frame latency.