diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 12 | ||||
-rw-r--r-- | src/openglgraphics.h | 8 |
3 files changed, 24 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2008-11-01 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/openglgraphics.h, src/openglgraphics.cpp: Made an option around + the syncing, but no way to change it for now. + 2008-09-21 Kevin Day ("Blame") <blame@aethyra.com> * Added the update.sh script to work with autobuild.sh diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index eeedcdf1..b3a8db4b 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -43,7 +43,8 @@ #endif OpenGLGraphics::OpenGLGraphics(): - mAlpha(false), mTexture(false), mColorAlpha(false) + mAlpha(false), mTexture(false), mColorAlpha(false), + mSync(false) { } @@ -51,6 +52,11 @@ OpenGLGraphics::~OpenGLGraphics() { } +void OpenGLGraphics::setSync(bool sync) +{ + mSync = sync; +} + bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) { logger->log("Setting video mode %dx%d %s", @@ -74,6 +80,10 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) #ifdef __APPLE__ // long VBL = 1; // CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL); + if (mSync) { + const GLint VBL = 1; + CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL); + } #endif // Setup OpenGL diff --git a/src/openglgraphics.h b/src/openglgraphics.h index 7d39e306..ea30e019 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -31,6 +31,13 @@ class OpenGLGraphics : public Graphics ~OpenGLGraphics(); + /** + * Sets whether vertical refresh syncing is enabled. Takes effect after + * the next call to setVideoMode(). Only implemented on MacOS for now. + */ + void setSync(bool sync); + bool getSync() const { return mSync; } + bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel); bool drawImage(Image *image, @@ -72,6 +79,7 @@ class OpenGLGraphics : public Graphics private: bool mAlpha, mTexture; bool mColorAlpha; + bool mSync; }; #endif |