This commit is contained in:
artdeell 2021-02-21 10:56:38 +03:00
parent d8a58484da
commit 67487dcdba
4 changed files with 30 additions and 24 deletions

View File

@ -150,8 +150,8 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglInit(JNIEnv* env, j
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* env, jclass clazz, jlong window) {
EGLContext *currCtx = eglGetCurrentContext();
printf("EGLBridge: Comparing: thr=%d, this=%p, curr=%p\n", gettid(), window, currCtx);
if (window != 0x1 && (window == 0x0 || currCtx == EGL_NO_CONTEXT || currCtx == (EGLContext *) window)) {
if (window != 0x0 && potatoBridge.eglContextOld != NULL && potatoBridge.eglContextOld != (void *) window) {
if (currCtx == NULL || window == 0) {
/*if (window != 0x0 && potatoBridge.eglContextOld != NULL && potatoBridge.eglContextOld != (void *) window) {
// Create new pbuffer per thread
// TODO get window size for 2nd+ window!
int surfaceWidth, surfaceHeight;
@ -164,14 +164,14 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
};
potatoBridge.eglSurface = eglCreatePbufferSurface(potatoBridge.eglDisplay, config, surfaceAttr);
printf("EGLBridge: created pbuffer surface %p for context %p\n", potatoBridge.eglSurface, window);
}
potatoBridge.eglContextOld = (void *) window;
}*/
//potatoBridge.eglContextOld = (void *) window;
// eglMakeCurrent(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
printf("EGLBridge: Making current on window %p on thread %d\n", window, gettid());
EGLBoolean success = eglMakeCurrent(
potatoBridge.eglDisplay,
/* window==0 ? (EGLSurface *) 0 : */ potatoBridge.eglSurface,
/* window==0 ? (EGLSurface *) 0 : */ potatoBridge.eglSurface,
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
/* window==0 ? EGL_NO_CONTEXT : */ (EGLContext *) window
);
if (success == EGL_FALSE) {

View File

@ -963,6 +963,7 @@ public class GLFW
e.printStackTrace();
}
nativeEglMakeCurrent(window);
System.out.println(Long.toString(nativeEglGetCurrentContext(),16));
}
public static void glfwSwapBuffers(long window) {

View File

@ -396,7 +396,25 @@ public class Display {
displayY = (monitorHeight - mode.getHeight()) / 2;
}
glfwMakeContextCurrent(Window.handle);
//glfwMakeContextCurrent(Window.handle);
final DrawableGL drawable = new DrawableGL() {
public void destroy() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
return;
releaseDrawable();
super.destroy();
destroyWindow();
// x = y = -1;
// cached_icons = null;
reset();
}
}
};
drawable.context = new ContextGL(null, null, null);
drawable.context.makeCurrent();
Display.drawable = drawable;
context = org.lwjgl.opengl.GLContext.createFromCurrent();
glfwSwapInterval(0);
@ -714,24 +732,7 @@ public class Display {
}
};
final DrawableGL drawable = new DrawableGL() {
public void destroy() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
return;
releaseDrawable();
super.destroy();
destroyWindow();
// x = y = -1;
// cached_icons = null;
reset();
}
}
};
drawable.context = new ContextGL(null, null, null);
Display.drawable = drawable;
displayCreated = true;

View File

@ -59,4 +59,8 @@ public final class SharedDrawable extends DrawableGL {
// throw new UnsupportedOperationException();
}
@Override
public void makeCurrent() throws LWJGLException {
//stub
}
}