[GLFW] Fix EGL stuff

This commit is contained in:
khanhduytran0 2021-01-21 18:47:57 +07:00
parent e8cac591b1
commit 462afeca6a
2 changed files with 8 additions and 6 deletions

View File

@ -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());

View File

@ -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);