If I put the resolution in the AppSettings to something like 800x600, then put this canvas in a JPanel, the JPanel will resize fine every time, but the canvas will partially stop rendering. It will continue to stretch properly (aspect ratio changing), but the part that is stretching stops rendering for some reasons. I’m not sure if its a jme or lwjgl glitch, but I know the problem is not on my side, because setting the resolution of the canvas (appsettings) at 4x3, then adding the canvas to the panel fixes the problem.
If someone knows what’s going on, let me know :3
This problem can be fixed by adding the canvas to a proper LayoutManager, but we can’t use other components at the same time without crashing or locking the canvas. (We can’t have a canvas with a transparent jpanel on top without crashing)
Hi, to mixe jme and swing, I used my own lib (less performante but swing friendly) GitHub - davidB/jme3_ext_swing: an experimental display of JME into JPanel, you have a sample usage under src/test
I actually fixed the problem by adding the canvas in a jpanel, and by using the guiNode from jme for displaying the in-game hud. So all my menu are in swing, except the one(s) that need to have the jme canvas.
I was actually able to put the canvas along a swing component in a jpanel, but the transparency was not working (my hud is an “overlay” that I put over the canvas". Its actually a bug between awt heavyweight component and swing lightweight component.
off topic question, why don’t you use JavaFX?