summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-31 17:13:53 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-31 17:13:53 +0100
commit0c8980d0d68faaff62b96555d0bb050ee767c4dd (patch)
tree1aaaba273bc85360155ec4c95314d4de56641932 /src
parent00e16d73c34a894ff70bae27eb22be14a245543d (diff)
downloadmana-0c8980d0d68faaff62b96555d0bb050ee767c4dd.tar.gz
mana-0c8980d0d68faaff62b96555d0bb050ee767c4dd.tar.bz2
mana-0c8980d0d68faaff62b96555d0bb050ee767c4dd.tar.xz
mana-0c8980d0d68faaff62b96555d0bb050ee767c4dd.zip
Made an option around the syncing, but no way to change it for now.
(cherry picked from mainline commit f6f8b2f885145d4cacf7a6c42d88b6a39f71b366) Conflicts: src/openglgraphics.cpp
Diffstat (limited to 'src')
-rw-r--r--src/openglgraphics.cpp16
-rw-r--r--src/openglgraphics.h8
2 files changed, 20 insertions, 4 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index d8d7a807..48b10a1f 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -45,7 +45,8 @@
#include "resources/image.h"
OpenGLGraphics::OpenGLGraphics():
- mAlpha(false), mTexture(false), mColorAlpha(false)
+ mAlpha(false), mTexture(false), mColorAlpha(false),
+ mSync(false)
{
}
@@ -53,6 +54,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,8 +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
@@ -352,7 +360,7 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable)
void OpenGLGraphics::drawRectangle(const gcn::Rectangle& rect, bool filled)
{
- float offset = filled ? 0 : 0.5f;
+ const float offset = filled ? 0 : 0.5f;
setTexturingAndBlending(false);
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