From 5f221874519bcbca6a20ac7da5980632a3ffb06f Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 2 Sep 2019 18:59:05 +0100 Subject: [PATCH] Blit before swapping framebuffers This fixes latency (and also screen corruption when resizing), as we blitted a framebuffer that had already been displayed on the off-screen window rather than the one that had just been rendered. --- gl-natives/src/main/c/jaggl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gl-natives/src/main/c/jaggl.c b/gl-natives/src/main/c/jaggl.c index 9a7cbfe..4a88e77 100644 --- a/gl-natives/src/main/c/jaggl.c +++ b/gl-natives/src/main/c/jaggl.c @@ -725,6 +725,8 @@ JNIEXPORT jboolean JNICALL Java_jaggl_context_swapBuffers(JNIEnv *env, jclass cl #elif defined(_WIN32) result = (jboolean) SwapBuffers(jaggl_device); #elif defined(__APPLE__) && defined(__MACH__) + [jaggl_layer blit]; + /* * This buffer swap isn't strictly necessary (in fact, I'm not sure if we * need to double buffer at all on macOS), but it is useful when the @@ -735,8 +737,6 @@ JNIEXPORT jboolean JNICALL Java_jaggl_context_swapBuffers(JNIEnv *env, jclass cl } else { glFlush(); } - - [jaggl_layer blit]; #else #error Unsupported platform #endif