From 462afeca6a5e24de85a35874c34a4977d5dc51e1 Mon Sep 17 00:00:00 2001 From: khanhduytran0 Date: Thu, 21 Jan 2021 18:47:57 +0700 Subject: [PATCH] [GLFW] Fix EGL stuff --- app_pojavlauncher/src/main/jni/egl_bridge.c | 3 ++- jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index eecf16036..2e474bf4e 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -220,11 +220,12 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* if (window != 0x1) { printf("Making current on window %p\n", window); + potatoBridge.eglContext = (EGLContext *) window; EGLBoolean success = eglMakeCurrent( potatoBridge.eglDisplay, potatoBridge.eglSurface, potatoBridge.eglSurface, - /* window==0 ? EGL_NO_CONTEXT : */ (EGLContext *) window + /* window == 0 ? EGL_NO_CONTEXT : */ (EGLContext *) window ); if (success == EGL_FALSE) { printf("Error: eglMakeCurrent() failed: %p\n", eglGetError()); diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java index 65eb0d564..a1a57e676 100644 --- a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java @@ -772,11 +772,7 @@ public class GLFW } static boolean isGLFWReady; public static boolean glfwInit() { - if (!isGLFWReady) { - mGLFWInitialTime = (double) System.nanoTime(); - isGLFWReady = nativeEglInit(); - } - return isGLFWReady; + return true; } public static void glfwTerminate() { @@ -982,6 +978,11 @@ public class GLFW // GLFW Window functions public static long glfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) { + if (!isGLFWReady) { + mGLFWInitialTime = (double) System.nanoTime(); + isGLFWReady = nativeEglInit(); + } + EventLoop.OffScreen.check(); // Create an ACTUAL EGL context long ptr = nativeEglCreateContext(share);