diff options
-rw-r--r-- | pugl/detail/implementation.c | 1 | ||||
-rw-r--r-- | pugl/detail/win_gl.c | 2 | ||||
-rw-r--r-- | pugl/pugl.h | 1 | ||||
-rw-r--r-- | test/pugl_test.c | 2 |
4 files changed, 5 insertions, 1 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 53af30b..1b7d4a4 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -39,6 +39,7 @@ puglSetDefaultHints(PuglHints hints) hints[PUGL_STENCIL_BITS] = 8; hints[PUGL_SAMPLES] = 0; hints[PUGL_DOUBLE_BUFFER] = PUGL_FALSE; + hints[PUGL_SWAP_INTERVAL] = 0; hints[PUGL_RESIZABLE] = PUGL_FALSE; hints[PUGL_IGNORE_KEY_REPEAT] = PUGL_FALSE; } diff --git a/pugl/detail/win_gl.c b/pugl/detail/win_gl.c index 0768a4e..eb7771c 100644 --- a/pugl/detail/win_gl.c +++ b/pugl/detail/win_gl.c @@ -220,7 +220,7 @@ puglWinGlCreate(PuglView* view) // Enter context and set swap interval wglMakeCurrent(impl->hdc, surface->hglrc); if (surface->procs.wglSwapInterval) { - surface->procs.wglSwapInterval(1); + surface->procs.wglSwapInterval(view->hints[PUGL_SWAP_INTERVAL]); } return 0; diff --git a/pugl/pugl.h b/pugl/pugl.h index 1bd49bb..3284a5c 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -110,6 +110,7 @@ typedef enum { PUGL_STENCIL_BITS, /**< Number of bits for stencil buffer */ PUGL_SAMPLES, /**< Number of samples per pixel (AA) */ PUGL_DOUBLE_BUFFER, /**< True if double buffering should be used */ + PUGL_SWAP_INTERVAL, /**< Number of frames between buffer swaps */ PUGL_RESIZABLE, /**< True if window should be resizable */ PUGL_IGNORE_KEY_REPEAT, /**< True if key repeat events are ignored */ diff --git a/test/pugl_test.c b/test/pugl_test.c index 65f764e..7ee04b8 100644 --- a/test/pugl_test.c +++ b/test/pugl_test.c @@ -324,6 +324,7 @@ main(int argc, char** argv) puglInitWindowHint(app.parent, PUGL_RESIZABLE, resizable); puglInitWindowHint(app.parent, PUGL_SAMPLES, samples); puglInitWindowHint(app.parent, PUGL_DOUBLE_BUFFER, doubleBuffer); + puglInitWindowHint(app.parent, PUGL_SWAP_INTERVAL, doubleBuffer); puglInitWindowHint(app.parent, PUGL_IGNORE_KEY_REPEAT, ignoreKeyRepeat); puglSetHandle(app.parent, &app); puglSetEventFunc(app.parent, onParentEvent); @@ -341,6 +342,7 @@ main(int argc, char** argv) puglInitWindowHint(app.child, PUGL_SAMPLES, samples); puglInitWindowHint(app.child, PUGL_DOUBLE_BUFFER, doubleBuffer); + puglInitWindowHint(app.child, PUGL_SWAP_INTERVAL, 0); puglInitBackend(app.child, puglGlBackend()); puglInitWindowHint(app.child, PUGL_IGNORE_KEY_REPEAT, ignoreKeyRepeat); puglSetHandle(app.child, &app); |