From 0f7b2ea9ca89cd7a586ba41c60e0b74eb7b7b0fb 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 9a7cbfea..4a88e77b 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