[SOLVED] jMonkeyPlatform (GDE) canvas issues

Home Forum Troubleshooting jMonkeyEngine SDK [SOLVED] jMonkeyPlatform (GDE) canvas issues

This topic contains 11 replies, has 3 voices, and was last updated by  Normen Hansen 4 years, 8 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #15349

    Normen Hansen
    2792p
    Keymaster

    Hey Monkeys,

    the former GDE and now jMonkeyPlatform is slowly becoming reality but I am still having massive problems including the OpenGL canvas working in the NetBeans platform / Swing windowing system. Since that keeps me from working on the more important things like proper base structure and features I was wondering if somebody who is more adept with lwjgl and/or jogl canvas implementation might want to have a look / give a hand, momoko_fan has got lots of other stuff to do.

    The problem(s):
    – SceneViewer goes blank sometimes when the window configuration changes
    – OpenGL canvas size is not updating correctly

    Where to look/what I found out until now:
    – The class that opens/uses the canvas is com.jme3.gde.core.sceneviewer.SceneViewerTopComponent.java
    – The com.jme3.system.lwjgl.LwjglCanvas quits the whole jme3 application when this happens, so the isDisplayable() method of the canvas returns false at that point
    – Even when the app is not destroyed at that point the screen gets lost
    – The containing window does not get any componentHidden or -Disposed messages when this happens
    – Seems like the component tree is modified somehow

    Build info for jMonkeyPlatform dev version can be found on the googlecode page.

    Hope to get some help ;),
    Normen

    #106659

    Momoko_Fan
    574p
    Keymaster

    I tried the TestCanvas test with both LWJGL and JOGL, tried minimizing, maximizing, resizing it, waiting, etc, but I couldn't get it to stop working :P Maybe it's a Mac issue? Does TestCanvas work correctly for you? Maybe it's netbeans platform pulling our leg.

    #106660

    pgi
    2p
    Member

    the size problem is a matter of layout managers. Use a GridLayout and assign a minimum-maximum-preferred size to the canvas != 0 and it works.
    I met a lot of weird things when trying to maximize or close and reopen the scene viewer. The display manager dies when the canvas parent is detached from the component tree and it doesn't seem happy to come back when the same canvas is reattached.
    To know when a component is attached-reattached you can use an AncestorListener or overwrite the addNotify-removeNotify methods of a component (SceneViewerTopComponent in this case).
    I played a bit with the code trying to restart the jme application context after a detach but i have an exception like this:

    org.lwjgl.opengl.OpenGLException: Invalid value (1281)
       at org.lwjgl.opengl.Util.checkGLError(Util.java:54)
       at org.lwjgl.opengl.GL20.glUseProgram(GL20.java:275)
       at com.jme3.renderer.lwjgl.LwjglRenderer.updateUniform(LwjglRenderer.java:477)
       at com.jme3.renderer.lwjgl.LwjglRenderer.updateShaderUniforms(LwjglRenderer.java:556)
       at com.jme3.renderer.lwjgl.LwjglRenderer.setShader(LwjglRenderer.java:751)
       at com.jme3.material.Material.render(Material.java:553)
       at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:237)
       at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:100)
       at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:139)
       at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:346)
       at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:446)
       at com.jme3.renderer.RenderManager.render(RenderManager.java:463)

    in the subsequent call of the application's update method.

    #106661

    Normen Hansen
    2792p
    Keymaster

    Momoko_Fan said:

    I tried the TestCanvas test with both LWJGL and JOGL, tried minimizing, maximizing, resizing it, waiting, etc, but I couldn't get it to stop working :P Maybe it's a Mac issue? Does TestCanvas work correctly for you? Maybe it's netbeans platform pulling our leg.

    orly? omg, f**k.. yeah, could really be the windowing adaptation of netbeans, gotta check that indepth  :cry:

    pgi said:

    the size problem is a matter of layout managers. Use a GridLayout and assign a minimum-maximum-preferred size to the canvas != 0 and it works.
    I met a lot of weird things when trying to maximize or close and reopen the scene viewer. The display manager dies when the canvas parent is detached from the component tree and it doesn't seem happy to come back when the same canvas is reattached.
    To know when a component is attached-reattached you can use an AncestorListener or overwrite the addNotify-removeNotify methods of a component (SceneViewerTopComponent in this case).
    I played a bit with the code trying to restart the jme application context after a detach but i have an exception like this:

    Good hint about the resizing. You use MacOS too?

    #106662

    pgi
    2p
    Member

    Windows XP.

    But is not a os problem, it's the layout manager you used that has a "particular" resizing behavior.

    #106663

    Normen Hansen
    2792p
    Keymaster

    pgi said:

    But is not a os problem, it's the layout manager you used that has a "particular" resizing behavior.

    I was asking because of the crash not because of the resizing ^^

    #106664

    Normen Hansen
    2792p
    Keymaster

    Momoko_Fan said:

    I tried the TestCanvas test with both LWJGL and JOGL, tried minimizing, maximizing, resizing it, waiting, etc, but I couldn't get it to stop working :P Maybe it's a Mac issue? Does TestCanvas work correctly for you? Maybe it's netbeans platform pulling our leg.

    Ah you just tested your own test classes, ok :) thought the SceneViewer worked on windows..

    #106665

    pgi
    2p
    Member

    The crash is probably related to the way i try to kill and recreate the jme3 context, it happens both with SceneViewer and the Canvas3D class i use for jps.
    Leaving the update method of SceneViewerApplication empty and destroying-recreating everything in the remove-add notify methods of SceneViewerTopComponent kinda works (the display manager goes off and on wthout problems).
    It isn't a good solution because restarting the display manager requires a few seconds and in the netbeans platform the components are added and removed quite often.
    The restart-start methods of the jme context didn't help: the display manager goes up and dies after few seconds.

    #106666

    Normen Hansen
    2792p
    Keymaster

    Ok, I added your change to svn and the resizing works now, thank you very much pgi, more input from you on the gde is of course very welcome! ;)

    #106667

    Momoko_Fan
    574p
    Keymaster

    This bug happens because the canvas is temporarily removed from the screen to re-adjust the layout to include other windows, etc. While this happens the canvas's native peer is destroyed so LWJGL is no longer bound to it. I was able to reproduce the bug outside of netbeans.
    I fixed the bug by using Display.setParent(null) while the canvas doesnt have a native peer, when the native peer comes back on, I call Display.setParent(canvas) to restore it again. Seems to work fine, I can play around with the jme3 window, move it around, resize it, put it into other components, etc and it doesn't break (altho it lags a bit when I do that, not sure why). Only problem is that when I close the window, the OpenGL thread continues to run for some reason and then obviously I get an exception, guess removeNotify is not called when the window is killed? When I try to open the jme3 window again through the menu netbeans freezes completely.

    #106668

    Momoko_Fan
    574p
    Keymaster

    Okay a full fix that works on both Windows and Macintosh is now in SVN! Hopefully this issue will trouble us no more.

    #106669

    Normen Hansen
    2792p
    Keymaster

    Momoko_Fan said:

    Okay a full fix that works on both Windows and Macintosh is now in SVN! Hopefully this issue will trouble us no more.

    Yay!

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.