summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-01 10:52:40 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-01 10:52:40 +0000
commitf6f8b2f885145d4cacf7a6c42d88b6a39f71b366 (patch)
treef94ac059d21ce42db01779c088eea7c22197bc6d
parentc2c435686f5b6c1152daf370fb1dcb98f7d789e2 (diff)
downloadmana-f6f8b2f885145d4cacf7a6c42d88b6a39f71b366.tar.gz
mana-f6f8b2f885145d4cacf7a6c42d88b6a39f71b366.tar.bz2
mana-f6f8b2f885145d4cacf7a6c42d88b6a39f71b366.tar.xz
mana-f6f8b2f885145d4cacf7a6c42d88b6a39f71b366.zip
Made an option around the syncing, but no way to change it for now.
-rw-r--r--ChangeLog5
-rw-r--r--src/openglgraphics.cpp14
-rw-r--r--src/openglgraphics.h8
3 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 63f76507..16d50f6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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-10-27 David Athay <ko2fan@gmail.com>
* src/commandhandler.cpp: Remove check command, now there is an NPC
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index b6a4e7d8..67248100 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -47,7 +47,8 @@
#include "resources/image.h"
OpenGLGraphics::OpenGLGraphics():
- mAlpha(false), mTexture(false), mColorAlpha(false)
+ mAlpha(false), mTexture(false), mColorAlpha(false),
+ mSync(false)
{
}
@@ -55,6 +56,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",
@@ -76,8 +82,10 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
}
#ifdef __APPLE__
- //const GLint 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 ee5bc1e1..e6d4850b 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -33,6 +33,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,
@@ -74,6 +81,7 @@ class OpenGLGraphics : public Graphics
private:
bool mAlpha, mTexture;
bool mColorAlpha;
+ bool mSync;
};
#endif