summaryrefslogtreecommitdiff
path: root/src/openglgraphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r--src/openglgraphics.cpp16
1 files changed, 12 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);