From Stephan Huber, "attached you'll find a small enhancement for GraphicsWindowCocoa to
implement the recently introduced setSyncToVBlank-method. Additionally I added a ToggleSyncToVBlank-eventhandler to osgViewer. I used it to test the code, perhaps you'll find it useful and include it in the distribution."
This commit is contained in:
@@ -379,6 +379,29 @@ class OSGVIEWER_EXPORT LODScaleHandler : public osgGA::GUIEventHandler
|
||||
int _keyEventDecreaseLODScale;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/** Event handler for toggling SyncToVBlank.*/
|
||||
class OSGVIEWER_EXPORT ToggleSyncToVBlankHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
ToggleSyncToVBlankHandler();
|
||||
|
||||
void setKeyEventToggleSyncToVBlankHandler(int key) { _keyEventToggleSyncToVBlank = key; }
|
||||
int getKeyEventToggleSyncToVBlankHandler() const { return _keyEventToggleSyncToVBlank; }
|
||||
|
||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
int _keyEventToggleSyncToVBlank;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ class GraphicsWindowCocoa : public osgViewer::GraphicsWindow, public osgViewer::
|
||||
GraphicsWindowCocoaWindow* getWindow() { return _window; }
|
||||
NSOpenGLPixelFormat* getPixelFormat() { return _pixelformat; }
|
||||
|
||||
void setVSync(bool f);
|
||||
virtual void setSyncToVBlank(bool f);
|
||||
|
||||
/** adapts a resize / move of the window, coords in global screen space */
|
||||
void adaptResize(int x, int y, int w, int h);
|
||||
|
||||
Reference in New Issue
Block a user