mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 06:39:54 -04:00
Try to get Forge 1.14+ work by try to get multiple GL contexts work
This commit is contained in:
parent
ab7c6584e2
commit
224c08aa5d
@ -3,9 +3,10 @@ HERE_PATH := $(LOCAL_PATH)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
# Link GLESv2 for test
|
||||
LOCAL_LDLIBS := -ldl -llog -landroid -lEGL -lGLESv2
|
||||
LOCAL_LDLIBS := -ldl -llog -landroid -lEGL
|
||||
# -lGLESv2
|
||||
LOCAL_MODULE := pojavexec
|
||||
LOCAL_CFLAGS += -DGLES_TEST
|
||||
# LOCAL_CFLAGS += -DGLES_TEST
|
||||
LOCAL_SRC_FILES := \
|
||||
egl_bridge.c \
|
||||
input_bridge.c \
|
||||
|
@ -20,6 +20,7 @@
|
||||
struct PotatoBridge {
|
||||
/* ANativeWindow */ void* androidWindow;
|
||||
|
||||
/* EGLContext */ void* eglContextOld;
|
||||
/* EGLContext */ void* eglContext;
|
||||
/* EGLDisplay */ void* eglDisplay;
|
||||
/* EGLSurface */ void* eglSurface;
|
||||
@ -63,11 +64,9 @@ 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) {
|
||||
if (potatoBridge.eglContext != EGL_NO_CONTEXT) {
|
||||
terminateEgl();
|
||||
}
|
||||
|
||||
// dlopen("libgl04es.so", RTLD_NOW + RTLD_GLOBAL);
|
||||
|
||||
potatoBridge.eglContextOld = potatoBridge.eglContext;
|
||||
potatoBridge.eglContext = eglCreateContext(potatoBridge.eglDisplay, config, potatoBridge.eglContextOld, ctx_attribs);
|
||||
} else {
|
||||
if (potatoBridge.eglDisplay == NULL || potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||
potatoBridge.eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||
@ -119,20 +118,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
||||
ANativeWindow_setBuffersGeometry(potatoBridge.androidWindow, 0, 0, vid);
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
potatoBridge.eglContext = eglCreateContext(potatoBridge.eglDisplay, config, EGL_NO_CONTEXT, ctx_attribs);
|
||||
if (!potatoBridge.eglContext) {
|
||||
printf("EGLBridge: Error eglCreateContext failed\n");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
// test eglQueryContext()
|
||||
{
|
||||
EGLint val;
|
||||
eglQueryContext(potatoBridge.eglDisplay, potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||
printf("EGLBridge: OpenGL ES from eglQueryContext: %i\n", val);
|
||||
// assert(val >= 2);
|
||||
}
|
||||
|
||||
potatoBridge.eglSurface = eglCreateWindowSurface(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL);
|
||||
|
||||
@ -147,6 +133,20 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
||||
assert(eglGetConfigAttrib(potatoBridge.eglDisplay, config, EGL_SURFACE_TYPE, &val));
|
||||
assert(val & EGL_WINDOW_BIT);
|
||||
}
|
||||
}
|
||||
if (!potatoBridge.eglContext) {
|
||||
printf("EGLBridge: Error eglCreateContext failed\n");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
// test eglQueryContext()
|
||||
{
|
||||
EGLint val;
|
||||
eglQueryContext(potatoBridge.eglDisplay, potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||
printf("EGLBridge: OpenGL ES from eglQueryContext: %i\n", val);
|
||||
// assert(val >= 2);
|
||||
}
|
||||
|
||||
// return JNI_TRUE;
|
||||
|
||||
printf("EGLBridge: Making current\n");
|
||||
@ -180,6 +180,9 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglTerminate(JNIEnv* e
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nativeRegalMakeCurrent(JNIEnv *env, jclass clazz) {
|
||||
printf("Regal: making current");
|
||||
|
||||
|
||||
|
||||
RegalMakeCurrent_func *RegalMakeCurrent = (RegalMakeCurrent_func *) dlsym(RTLD_DEFAULT, "RegalMakeCurrent");
|
||||
RegalMakeCurrent(potatoBridge.eglContext);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user