How can the 3D Viewer work again

java3d
3d-viewer
Tags: #<Tag:0x00007fb8823fa7e0> #<Tag:0x00007fb8823fa628>

#1

Ever since the Java 8 deblacle, the 3D Viewer is hanging in a limbo.

Any advice on how to get the 3D Viewer to work again?

I am running Ubuntu 16.04 with the latest nvidia driver.

If I use java 8 version 60 with the java 3d 1.5 libraries installed by hand, the 3D Viewer window shows but all grey (only the menu is readable). A CPU is stuck at 100%, and the terminal shows this error:

Canvas3D_createNewContext: couldn't create context
Exception occurred in RenderingErrorListener:
java.lang.RuntimeException
	at ij3d.ImageWindow3D$ErrorListener.errorOccurred(ImageWindow3D.java:330)
	at javax.media.j3d.VirtualUniverse.notifyRenderingErrorListeners(VirtualUniverse.java:1329)
	at javax.media.j3d.NotificationThread.processNotifications(NotificationThread.java:90)
	at javax.media.j3d.NotificationThread.run(NotificationThread.java:107)

If, instead, I use java 8 version 60 or 131 (latest as of today), and use the java-8 update site, then the 3D Viewer window never shows, and these errors are printed:

Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for EGLGraphicsDevice[type .egl, v0.0.0, connection :0, unitID 0, handle 0x0, owner true, ResourceToolkitLock[obj 0x13b8a301, isOwner true, <1d7f4f06, 1940c871>[count 1, qsz 0, owner <SciJava-2e6f610d-Thread-0-SharedResourceRunner>]]] on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:518)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: Failed to created/initialize EGL display incl. fallback default: native 0x0, error 0x3008/0x300c on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDisplayUtil.eglGetDisplayAndInitialize(EGLDisplayUtil.java:297)
    [1]: jogamp.opengl.egl.EGLDisplayUtil.access$300(EGLDisplayUtil.java:58)
    [2]: jogamp.opengl.egl.EGLDisplayUtil$1.eglGetAndInitDisplay(EGLDisplayUtil.java:320)
    [3]: com.jogamp.nativewindow.egl.EGLGraphicsDevice.open(EGLGraphicsDevice.java:125)
    [4]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:532)
    [5]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:516)
    [6]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [7]: java.lang.Thread.run(Thread.java:748)
Caught handled GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0xee02304, isOwner false, <2a12317d, 282ddfe6>[count 0, qsz 0, owner <NULL>]]] on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:306)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: SciJava-2e6f610d-Thread-0-SharedResourceRunner: Unable to create temp OpenGL context(1) on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:390)
    [1]: jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765)
    [2]: jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648)
    [3]: jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
    [4]: jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:277)
    [5]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [6]: java.lang.Thread.run(Thread.java:748)
Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0xee02304, isOwner true, <2a12317d, 282ddfe6>[count 1, qsz 0, owner <SciJava-2e6f610d-Thread-0-SharedResourceRunner>]]] on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:518)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: Failed to created/initialize EGL display incl. fallback default: native 0x0, error 0x3008/0x300c on thread SciJava-2e6f610d-Thread-0-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDisplayUtil.eglGetDisplayAndInitialize(EGLDisplayUtil.java:297)
    [1]: jogamp.opengl.egl.EGLDisplayUtil.access$300(EGLDisplayUtil.java:58)
    [2]: jogamp.opengl.egl.EGLDisplayUtil$1.eglGetAndInitDisplay(EGLDisplayUtil.java:320)
    [3]: com.jogamp.nativewindow.egl.EGLGraphicsDevice.open(EGLGraphicsDevice.java:125)
    [4]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:532)
    [5]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:516)
    [6]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [7]: java.lang.Thread.run(Thread.java:748)

#2

Others can chime in, but I’ll argue that it is kind of an uphill battle. The number of bugs that prohibit usability in 3D Viewer have been increasing quite a bit since the Java 8 issues. Some folks (mostly @ctrueden) have been playing whack-a-mole with 3D Viewer bugs, but it has been like an overcaffeinated red queen effect. I mean come on, he forked and started maintaining an alternate java3d in scijava; Curtis has better things to do than that.

With the demise of Java3D a lot of effort would have to be invested into swapping out the backend renderer. In the meantime @skalarproduktraum wrote a killer library, Scenery, that supports OpenGL, the new Vulkan API from Khronos, VR, and I’m sure I’m forgetting some features. I spent a couple of hackathons prototyping a ThreeDViewer building on top of Scenery, and @skalarproduktraum, @haesleinhuepf, @ctrueden, and even @axtimwalde have added code to the new viewer. For the past year I’ve moved across the US, started a new lab (and life, for that matter), and spent an inordinate amount of time trying to get funding for an RA to help on this (hence slow coding progress). Nevertheless, I’m off to CSBD/CBG (in less than 1 month now) for essentially the entire summer to work near the wizards of Dresden to get ThreeDViewer to a mature state.

The short answer: I punt on answering the specific question in hopes of replying with the release of a replacement viewer. I have to apologize for this. It is terribly frustrating having to punt until my pilgrimage this summer, but hopefully everyone will be happier with the result. Get your VR headsets, 3D datasets ready, we’re going to have an amazing Scenery-based 3D visualization package for ImageJ ready in the near future.


#3

Thanks for the efforts on new developments. The real issue is adapting e.g. TrakEM2 and other plugins that use the 3D Viewer for visualization. One would need a drop-in replacement API or close enough for any successor to fully replace the 3D Viewer.


#4

For immediate results: stick with Java 6 + Java 3D 1.5.

For short-term success with Java 8: dig into the problems with Java 3D 1.6 and fix them. I do not have sufficient bandwidth to investigate them, but others in the community could. I think many of them might be simpler than we fear. For example, fiji/3D_Viewer#17 was fixed by a simple change to Java’s command line options.

For longer-term success: Scenery + ThreeDViewer. I agree that updating all Fiji components to use it will be substantial effort. @kephale and @tferr are planning to pave the way using Simple Neurite Tracer. See also fiji/3D_Viewer#19.

Did you Google this error? I found this thread right away. Does it shed any light?


Zoom in/out not working when using 3Dviewer
3D Viewer doesn't work with Java8