-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactors the context restart code. #1526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Now most of the code that goes into initializing the renderer
|
I confirmed that this PR resolves issue #844, by running the test case from https://hub.jmonkeyengine.org/t/nifty-does-not-properly-display-gui-after-app-restart-when-gamma-correction-is-enabled/40213/19 and repeatedly pressing the 'T' and 'Tab' keys. |
jme3-examples/src/main/java/jme3test/renderer/TestContextRestart.java
Outdated
Show resolved
Hide resolved
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
Outdated
Show resolved
Hide resolved
|
I ran With jme3-lwjgl (LWJGL 2.9.3) pressing 'Tab' causes the box to disappear. With jme3-lwjgl3 (LWJGL 3.2.3 build 13) pressing 'Tab' causes a momentary flicker but the box does not disappear. |
|
@Markil3 do you intend to act on my comments? |
|
Things have gotten a bit crazy over on my end. I'll try to finish these by the weekend, though. Sorry! Completely forgot! |
|
So, I investigated your issue, and it seems to be linked to the AppSettings.setRenderer setting. I can change this to whatever I want on jme3-lwjgl3, but trying to set this on jme3-lwjgl seems to cause problems. I'm investigating it now, but at least it seems to work on the recommended library. |
|
Well, this is interesting: moving the call to initialize the GL renderer so that it only triggers upon the first run seems to solve the issue. However, trying to do the same on the jme3-lwjgl3 library breaks it if I'm using something other than OpenGL 2.0. No idea what's going on underneath, but it works without any major problems, so I guess I'll just apply that fix. |
Apparently, this seems to fix the issue of LWJGL not rendering to the new display. However, trying to apply this fix to jme3-lwjgl3 actually creates the problem there.
| } | ||
|
|
||
| /** | ||
| * Reinitializes the relevent details of the context. For internal use only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct the spelling of "relevant". "Relevent" is not a word in English.
|
In the interest of keeping things moving, I've decided to integrate this and fix the spelling later. |
* Refactors the context restart code. Now most of the code that goes into initializing the renderer * Fixed a misleading comment in lwjgl3's LwjglWindow * Adds documentation to the LwjglContext methods. * Cleans up the code and comments. * Moves the renderer initialization for jme3-lwjgl to just the first run. Apparently, this seems to fix the issue of LWJGL not rendering to the new display. However, trying to apply this fix to jme3-lwjgl3 actually creates the problem there.
|
@Markil3 Thank you for contributing to JMonkeyEngine! |
|
Verified the fix in v3.4.0-beta4. |
https://hub.jmonkeyengine.org/t/white-screen-on-context-restart/43866/28?u=markil3
Now most of the code that goes into initializing the renderer is now repeated every time. This is accomplished by moving most of the logic from the initContextFirstTime() methods into a new initContext(boolean) method. On the first boot, the code ultimately executes the same way. However, every context restart calls initContext(false) now as well. This will repeat all the code from before save for the creation of the GL and Renderer instances as well as input initialization.
At the moment, SimpleApplication now has a new default binding for the TAB key that restarts the context. This is to make it easier to test various examples, and I plan on removing it before we actually merge it.
This should solve issues #844 and #1445. This commit should also replace PR #1524.