fiji / 3D_Viewer

https://imagej.net/plugins/3d-viewer
GNU General Public License v3.0
20 stars 18 forks source link

Resizing 3D Viewer window can throw an exception #15

Open ctrueden opened 8 years ago

ctrueden commented 8 years ago

When using the Java-8 update site, resizing the 3D Viewer window leads to:

com.jogamp.opengl.GLException: detachAllImpl failed: FBO implementation fault, FBO[name r/w 1/1, init true, bound true, size 814x830, samples 0/8, modified true/true, depth RenderAttachment[type DEPTH, format 0x81a5, samples 0, 814x830, name 0xffffffff, obj 0x631efb05], stencil null, colorbuffer attachments: 1/8, with 1 textures: [TextureAttachment[type COLOR_TEXTURE, target GL_TEXTURE_2D, level 0, format 0x8051, 814x830, border 0, dataFormat 0x1907, dataType 0x1401; min/mag 0x2600/0x2600, wrap S/T 0x812f/0x812f; name 0xffffffff, obj 0xd24d2a0], null, null, null, null, null, null, null], msaa[null, hasSink false, dirty true], state FBO implementation fault, obj 0x48049414]
    at com.jogamp.opengl.FBObject.detachAllImpl(FBObject.java:2198)
    at com.jogamp.opengl.FBObject.reset(FBObject.java:1139)
    at org.scijava.java3d.JoglPipeline.resizeOffscreenLayer(JoglPipeline.java:6290)
    at org.scijava.java3d.Canvas3D.setViewport(Canvas3D.java:4864)
    at org.scijava.java3d.Renderer.doWork(Renderer.java:993)
    at org.scijava.java3d.J3dThread.run(J3dThread.java:271)

At least, I am able to reproduce consistently on my system using the T1 Head sample:

OS X 10.11.1 El Capitan Model Name: MacBook Pro Model Identifier: MacBookPro11,5 Processor Name: Intel Core i7 Processor Speed: 2.5 GHz

Both Java versions 1.7.0_80 and 1.8.0_66 exhibit the issue. So it is probably a bug in Java 3D 1.6 and/or JOGL.

I tried to create an MCVE based on the "Test Java3D" plugin from VIB, but was unable to reproduce the issue with a simple scene.

See also this thread on the ImageJ mailing list.

ctrueden commented 8 years ago

@gouessej FYI. I will try to track down more details and file a formal bug report and/or patch once I do so. But it probably will not be until February or March, unfortunately.

ghost commented 8 years ago

Thanks. There is no hurry.

rogersher commented 8 years ago

I am having the same trouble. When I use Fiji 3D viewer I can rotate the image and zoom in with the mouse wheel, but as soon as I try to resize the 3D viewer window or change the background color, the program freezes. I can still click between open FIJI windows but none of them respond to anything. I need to force quit the application everytime.

hinerm commented 8 years ago

see also

tinevez commented 8 years ago

This issue is specific to MacOSX. I cannot reproduce it with Windows.

ctrueden commented 8 years ago

On Linux, resizing the window crashed Java. :-1:

mani-mota commented 8 years ago

Can confirm this behavior on OSX 10.11.5, Java 8, GTX950

Any progress on this? Does anyone have a workaround?

ctrueden commented 8 years ago

@mani-mota Sorry, I know of no workaround.

You could, however, try ClearVolume and/or the new ThreeDViewer prototype. These are certainly the directions 3D viz in ImageJ is going.

richardwcole commented 8 years ago

I am now getting the following error

version = 1.5 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) nFrames = 1

Same test data set that has worked in the past

ctrueden commented 8 years ago

@richardwcole That error means you are using Java 3D 1.5 (i.e., the old Java 3D), but running Java 8. On many systems, these two technologies cannot be combined.

For details, see this page:

In short, you can either: A) use Java 3D 1.5 + Java 6; or B) use the new Java 3D 1.6 + Java 8.

tinevez commented 8 years ago

Groumph I checked and indeed it does not work from a Fiji.app application.

I thought it worked fine at least on windows because I can get it to work from Eclipse, where I develope: screenshot

ctrueden commented 6 years ago

I can no longer reproduce this on my macOS 10.13.4 machine with Java 1.8.0_172. Could those affected (@rogersher @mani-mota et. al) please download a fresh Fiji and test again and report back on whether the issue is resolved for you?

Stephy43 commented 6 years ago

@ctrueden did you ever find a solution for the resizing on linux? I'm using a VNC to connect to our analytical machine (linux) and if I resize the VNC window when Fiji has an image open, it crashes Fiji :( Any tips?

ctrueden commented 6 years ago

@Stephy43 I'm sorry, I don't have a real solution. And I was wrong about not being able to reproduce on macOS—it does happen still, I think it's a race condition triggering when two resizes occur in rapid succession.

I discovered that on macOS, the following Groovy script can be used to resize the window without it crashing:

viewers = java.awt.Window.getWindows().findAll{w -> w.getTitle().contains("3D Viewer")}
viewers.each{w -> w.setSize(new java.awt.Dimension((int) w.getWidth(), (int) (w.getHeight() - 1)))}

(The w.getWidth() and w.getHeight() - 1 could be anything you want.)

You could give this a try in your Linux VNC session and see if it helps.

ctrueden commented 6 years ago

One thing I just noticed: @philjord, the current maintainer of the JOGL Java 3D fork, fixed a bunch of things ~1 year after I packaged up the java3d code for ImageJ. I have not tested those changes yet, and will not have time to do so before mid-June. In the meantime, you could clone https://github.com/philjord/java3d-core and build the dev1.7.0 branch (mvn package) and see if the new artifact makes any difference.

ghost commented 6 years ago

@ctrueden I remind you that I'm going to leave Github soon because of its acquisition by Microsoft. I'll update the user's guide. Rather use directly Phil's source code.