mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-01 14:19:12 -06:00
Display & LWJGL updates
Modified gl_bridge: now the 1st context made current is the rendering context Modified lwjgl: now it ignores calls done without initialized GLCapabilities instead of crashing the game. This should fix Essesnsestiatl and remove the need for static Display.create workaround Why? It removed the excess context creation and thus the 1st created context is the actual rendering context, not a random init context. Modified Display: removed static init and added checks so that it won't try changing video modes for a non-existent window
This commit is contained in:
parent
77480b8ed2
commit
a7b0a10410
7 changed files with 17 additions and 18 deletions
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
1654610266310
|
||||
1663700709650
|
||||
|
|
@ -144,23 +144,31 @@ void gl_make_current(render_bundle_t* bundle) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
bool hasSetMainWindow = false;
|
||||
if(mainWindowBundle == NULL) {
|
||||
mainWindowBundle = bundle;
|
||||
__android_log_print(ANDROID_LOG_INFO, g_LogTag, "Main window bundle is now %p", mainWindowBundle);
|
||||
mainWindowBundle->newNativeSurface = newWindow;
|
||||
hasSetMainWindow = true;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, g_LogTag, "Making current, surface=%p, nativeSurface=%p, newNativeSurface=%p", bundle->surface, bundle->nativeSurface, bundle->newNativeSurface);
|
||||
if(bundle->surface == NULL) { //it likely will be on the first run
|
||||
gl_swap_surface(bundle);
|
||||
}
|
||||
if(eglMakeCurrent_p(g_EglDisplay, bundle->surface, bundle->surface, bundle->context)) {
|
||||
currentBundle = bundle;
|
||||
}else __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "eglMakeCurrent returned with error: %04x", eglGetError_p());
|
||||
}else {
|
||||
if(hasSetMainWindow) {
|
||||
mainWindowBundle->newNativeSurface = NULL;
|
||||
gl_swap_surface(mainWindowBundle);
|
||||
mainWindowBundle = NULL;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_ERROR, g_LogTag, "eglMakeCurrent returned with error: %04x", eglGetError_p());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void gl_swap_buffers() {
|
||||
if(mainWindowBundle == NULL) {
|
||||
mainWindowBundle = currentBundle;
|
||||
__android_log_print(ANDROID_LOG_INFO, g_LogTag, "Main window bundle is now %p", mainWindowBundle);
|
||||
mainWindowBundle->state = STATE_RENDERER_NEW_WINDOW;
|
||||
mainWindowBundle->newNativeSurface = newWindow;
|
||||
}
|
||||
if(currentBundle->state == STATE_RENDERER_NEW_WINDOW) {
|
||||
eglMakeCurrent_p(g_EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); //detach everything to destroy the old EGLSurface
|
||||
gl_swap_surface(currentBundle);
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -82,15 +82,6 @@ public class Display {
|
|||
|
||||
mode = desktopDisplayMode = new DisplayMode(monitorWidth, monitorHeight, monitorBitPerPixel, monitorRefreshRate);
|
||||
LWJGLUtil.log("Initial mode: " + desktopDisplayMode);
|
||||
if("true".equals(System.getProperty("org.lwjgl.opengl.disableStaticInit"))) {
|
||||
LWJGLUtil.log("Static Display.create() disabled");
|
||||
}else{
|
||||
// additional code workaround not called yet!
|
||||
LWJGLUtil.log("Calling Display.create()");
|
||||
try {
|
||||
create();
|
||||
} catch (LWJGLException e) {throw new RuntimeException(e);}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSwapInterval(int value) {
|
||||
|
|
@ -861,7 +852,7 @@ public class Display {
|
|||
|
||||
public static void setDisplayMode(DisplayMode dm) throws LWJGLException {
|
||||
mode = dm;
|
||||
GLFW.glfwSetWindowSize(Window.handle, dm.getWidth(), dm.getHeight());
|
||||
if(isCreated) GLFW.glfwSetWindowSize(Window.handle, dm.getWidth(), dm.getHeight());
|
||||
}
|
||||
|
||||
public static DisplayMode getDisplayMode() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue