summaryrefslogtreecommitdiff
path: root/src/openglgraphics.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-07-22 21:50:50 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-08-12 21:45:15 +0200
commitdfb24aff4c683471fec95392a9d3a46687f40f28 (patch)
tree68929dd83fdd5a6835a386b5fc456cb0a93a3e78 /src/openglgraphics.h
parenta330879c88a12d82c3b63dba08dcb5df6b46b242 (diff)
downloadmana-dfb24aff4c683471fec95392a9d3a46687f40f28.tar.gz
mana-dfb24aff4c683471fec95392a9d3a46687f40f28.tar.bz2
mana-dfb24aff4c683471fec95392a9d3a46687f40f28.tar.xz
mana-dfb24aff4c683471fec95392a9d3a46687f40f28.zip
Removed manual calling of glFlush and made glFinish optional
Actually neither glFlush nor glFinish need to be called manually [1]. However, the rendering pipeline is then free to queue up future frames which can cause a lag which is especially noticable with mouse movement. To avoid this lag, we call glFinish after SDL_GL_SwapBuffers. This makes sure processing of the next frame does not start before the current frame is being displayed. [1] http://www.opengl.org/wiki/Common_Mistakes#glFinish_and_glFlush Reviewed-by: Yohann Ferreira Sounded-fine-to: Erik Schilling
Diffstat (limited to 'src/openglgraphics.h')
-rw-r--r--src/openglgraphics.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/openglgraphics.h b/src/openglgraphics.h
index a1d78e46..63c32261 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -43,6 +43,16 @@ class OpenGLGraphics : public Graphics
void setSync(bool sync);
bool getSync() const { return mSync; }
+ /**
+ * Sets whether input lag should be reduced.
+ *
+ * This means waiting until the graphics card has finished drawing and
+ * displaying the current frame until continuing towards the next,
+ * possibly at the cost of performance and CPU usage.
+ */
+ void setReduceInputLag(bool reduceInputLag);
+ bool getReduceInputLag() const { return mReduceInputLag; }
+
bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel);
bool drawImage(Image *image,
@@ -114,6 +124,7 @@ class OpenGLGraphics : public Graphics
bool mAlpha, mTexture;
bool mColorAlpha;
bool mSync;
+ bool mReduceInputLag;
};
#endif //USE_OPENGL