I am trying to troubleshoot why when I restart the jme context, the new window just comes up white. But the app is not frozen, key input still works and the window is responsive., the screen is just rendering white. I built a test case, but the test case works correctly.
I have been disabling code within my client trying to figure out why the context restart is not working, but I have not had any luck yet. Does anyone have an idea as to what is going on, or a way to troubleshoot it so I can narrow down what I have broken?
I have had this same issue when I was making an app with jME. It’s really annoying when it comes up because it doesn’t typically tell you what’s wrong in the logs, and from what I know there are many different reasons why it occurs.
One way it happened with me that I can remember from the top of my head, is when I was using the wrong bullet library (i was using the non android library by accident) for my app, but the actual code was completly fine, void of any issues.
Turning on debug mode (using android studio) will show the error in the logs when launching it up, so that might give you a hint on what’s wrong, but from my belief the reason this is caused is that something outside of the code of the game, but rather the android project structure.
As for gamma on lwjgl-2 after restart, I put System.out.println(getContext().getSettings().isGammaCorrection()); in simpleUpdate and the value did not change after the context restart. I am not too concerned about it though as I mainly use lwjgl3, so I am much more concerned about the context not coming back up for it.
So, I ran your test case on my end, and I made a few observations:
The screen blank only seems to happen on the jme3-lwjgl3 library when messing with the “setRenderer” option in the app settings (specifically, setting it to any OPENGL version 3 or 4). Setting it to OpenGL 2 or not setting it at all doesn’t seem to blank it (although colors will still darken)
A regular context restart won’t trigger anything normally on the jme3-lwjgl library. However, setting stencil bits, depth bits, bits per pixel, or samples prior to the restart will trigger any of the above behavior (darkening colors on OPENGL2 compatibility, screen blanking on OPENGL 3 or 4 compatibility).
The darkening barely affects color channels close to the maximum
From what I can see, restarting the context seems to turn the gamma correction system off, despite what is in the settings. Chances are, there is probably a bug somewhere in this. I’ll do some digging and see if I can locate it.
UPDATE: When the application runs for the first time in jme3-lwjgl3, isGammaCorrection is called first from LwjglWindow’s createContext(AppSettings) method, but is then called twice on LwjglContext’s initContextFirstTime() method. However, when I restart the context, it is only called from LwjglWindow, and not LwjglContext. Apparently, the lines in LwjglContext are critical for enabling gamma correction in the jme3-lwjgl3 library.
UPDATE 2: For the jme3-lwjgl library, isGammaCorrection() isn’t called from anywhere but LwjglContext’s initContextFirstTime() method. Naturally, this method is not called when restarting the context. Oddly enough, though, this doesn’t seem to matter if the samples or bits or anything haven’t been changed. I’m guessing there may be some sort of flag that checks if these have changed for jme3-lwjgl.