#include <vsync.h>

Uses glXWaitVideoSyncSGI() to wait for retrace. Phase-maintaining, meaning WaitForFrame should always return approximately the same time after a vertical retrace.
This works with version 50 or later of the nVidia vendor drivers.
Special care must be taken with this video sync method due to a bad interaction between some pthread implementations and OpenGL. OpenGL DIRECT contexts can not be shared between processes. And some pthread implementations, notably a common one on Linux, treat each thread as a seperate process. Hence Start(void), Stop(void) and WaitForFrame(void) must all be called from the same thread.
http://www.ac3.edu.au/SGI_Developer/books/OpenGLonSGI/sgi_html/ch10.html#id37188
Definition at line 205 of file vsync.h.
Public Member Functions | |
| OpenGLVideoSync (VideoOutput *, int frame_interval, int refresh_interval, bool interlaced) | |
| ~OpenGLVideoSync () | |
| QString | getName (void) const |
| Returns name of instanciated VSync method. | |
| bool | TryInit (void) |
| Try to create an OpenGL surface so we can use glXWaitVideoSyncSGI:. | |
| void | Start (void) |
| Start VSync; must be called from main thread. | |
| void | WaitForFrame (int sync_delay) |
| Waits for next a frame or field. | |
| void | AdvanceTrigger (void) |
| Use the next frame or field for CalcDelay(void) and WaitForFrame(int). | |
Private Attributes | |
| GLXDrawable | m_drawable |
| GLXContext | m_context |
| QMutex | m_lock |
| OpenGLVideoSync::OpenGLVideoSync | ( | VideoOutput * | video_output, | |
| int | frame_interval, | |||
| int | refresh_interval, | |||
| bool | interlaced | |||
| ) |
| QString OpenGLVideoSync::getName | ( | void | ) | const [inline, virtual] |
| bool OpenGLVideoSync::TryInit | ( | void | ) | [virtual] |
| void OpenGLVideoSync::Start | ( | void | ) | [virtual] |
Start VSync; must be called from main thread.
Start(void), WaitForFrame(void), and Stop(void) should always be called from same thread, to prevent bad interactions with pthreads.
Reimplemented from VideoSync.
| void OpenGLVideoSync::WaitForFrame | ( | int | sync_delay | ) | [virtual] |
Waits for next a frame or field.
Start(void), WaitForFrame(void), and Stop(void) should always be called from same thread, to prevent bad interactions with pthreads.
| sync_delay | time until the desired frame or field |
Implements VideoSync.
| void OpenGLVideoSync::AdvanceTrigger | ( | void | ) | [virtual] |
GLXDrawable OpenGLVideoSync::m_drawable [private] |
Definition at line 219 of file vsync.h.
Referenced by Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().
GLXContext OpenGLVideoSync::m_context [private] |
Definition at line 220 of file vsync.h.
Referenced by Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().
QMutex OpenGLVideoSync::m_lock [private] |
Definition at line 223 of file vsync.h.
Referenced by AdvanceTrigger(), Start(), TryInit(), WaitForFrame(), and ~OpenGLVideoSync().
1.5.5