BGE: Flipping vsync constants so VSYNC_ON is 0.
authorMitchell Stokes <mogurijin@gmail.com>
Sat, 17 Aug 2013 02:06:45 +0000 (02:06 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sat, 17 Aug 2013 02:06:45 +0000 (02:06 +0000)
This will make transitions from older versions of Blender easier since VSYNC_ON
will be the default. This could have been changed in a do_version, but the vsync
code has yet to see an official release, so I figured this would be a bit nicer.
Also, this makes VSYNC_ON the default for new scenes as well.

source/blender/makesdna/DNA_scene_types.h
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp

index ceb745cf90a4f65a4af0c2baf6bf72e7bdde5531..002d77fb0e62c01ce95562499899ec43585c1d3f 100644 (file)
@@ -693,8 +693,8 @@ typedef struct GameData {
 #define RAS_STORE_VBO          3
 
 /* vsync */
-#define VSYNC_OFF      0
-#define VSYNC_O      1
+#define VSYNC_O      0
+#define VSYNC_OFF      1
 #define VSYNC_ADAPTIVE 2
 
 /* GameData.flag */
index 7b5f5a7096a9db3748d4895be5aea687b6bd7391..c3bd93fec81a4cd99549811ca6a81aafa0034f76 100644 (file)
@@ -290,7 +290,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                if (startscene->gm.vsync == VSYNC_ADAPTIVE)
                        canvas->SetSwapInterval(-1);
                else
-                       canvas->SetSwapInterval(startscene->gm.vsync); // VSYNC_OFF == 0, VSYNC_ON == 1, so this works
+                       canvas->SetSwapInterval(!startscene->gm.vsync); // VSYNC_OFF == 1, VSYNC_ON == 0, so this works
 
                RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
                RAS_IRasterizer* rasterizer = NULL;
index c3cbf381af4a2a9f85c981ec112a54eab8baf1de..88468ecc88a518982bfe96fb67cfb38e8242ca1e 100644 (file)
@@ -586,7 +586,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
                if (gm->vsync == VSYNC_ADAPTIVE)
                        m_canvas->SetSwapInterval(-1);
                else
-                       m_canvas->SetSwapInterval(gm->vsync); // VSYNC_OFF == 0, VSYNC_ON == 1, so this works
+                       m_canvas->SetSwapInterval(!gm->vsync); // VSYNC_OFF == 1, VSYNC_ON == 0, so this works
 
                m_canvas->Init();
                if (gm->flag & GAME_SHOW_MOUSE)
index ae9cbbb2656ac4176c73dd6e7487206d2238d589..efda1c5301b7fe389c99a51efa887e473edd23ff 100644 (file)
@@ -1378,14 +1378,14 @@ static PyObject *gPySetVsync(PyObject *, PyObject *args)
        if (!PyArg_ParseTuple(args, "i:setVsync", &interval))
                return NULL;
 
-       if (interval < VSYNC_OFF || interval > VSYNC_ADAPTIVE) {
+       if (interval < 0 || interval > VSYNC_ADAPTIVE) {
                PyErr_SetString(PyExc_ValueError, "Rasterizer.setVsync(value): value must be VSYNC_OFF, VSYNC_ON, or VSYNC_ADAPTIVE");
                return NULL;
        }
 
        if (interval == VSYNC_ADAPTIVE)
                interval = -1;
-       gp_Canvas->SetSwapInterval(interval);
+       gp_Canvas->SetSwapInterval(!interval); // VSYNC_OFF == 1, VSYNC_ON == 0, so this works
        Py_RETURN_NONE;
 }