From Marius Heise, "here is a patch that implements Win32 HW-synced swapping using wglJoinSwapGroupNV, wglBindSwapBarrierNV and the existing traits. It was tested with multiple ATI FirePro S400 cards.

I also fixed the vsync implementation introduced with rev.11357 that was crashing with the Windows Error #170. So I removed your temporary /* */ around the vsync condition..."
This commit is contained in:
Robert Osfield
2011-04-21 13:34:03 +00:00
parent 02081af4f8
commit 634344aef5
5 changed files with 61 additions and 9 deletions

View File

@@ -108,6 +108,11 @@ class OSG_EXPORT GraphicsContext : public Object
// V-sync
bool vsync;
// Swap Group
bool swapGroupEnabled;
GLuint swapGroup;
GLuint swapBarrier;
// use multithreaded OpenGL-engine (OS X only)
bool useMultiThreadedOpenGLEngine;

View File

@@ -145,6 +145,14 @@ class OSGVIEWER_EXPORT GraphicsWindow : public osg::GraphicsContext, public osgG
bool getSyncToVBlank() const { return _traits.valid() ? _traits->vsync : true; }
/** Set swap group. */
virtual void setSwapGroup(bool on, GLuint group, GLuint barrier)
{
osg::notify(osg::NOTICE) << "GraphicsWindow::setSwapGroup(" << on << " " << group << " " << barrier << ") not implemented." << std::endl;
}
void getSwapGroup(bool& on, GLuint& group, GLuint& barrier) const { on = _traits->swapGroupEnabled; group = _traits->swapGroup; barrier = _traits->swapBarrier; }
public:
/** Return whether a valid and usable GraphicsContext has been created.*/

View File

@@ -90,6 +90,9 @@ class OSGVIEWER_EXPORT GraphicsWindowWin32 : public osgViewer::GraphicsWindow, p
/** Set sync-to-vblank. */
virtual void setSyncToVBlank(bool on);
/** Set swap group. */
virtual void setSwapGroup(bool on, GLuint group, GLuint barrier);
/** Handle a native (Win32) windowing event as received from the system */
virtual LRESULT handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );