Skip to content
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

Empty canvas and GLException with Java 8 on Windows #17

Closed
imagejan opened this issue Jan 4, 2016 · 34 comments
Closed

Empty canvas and GLException with Java 8 on Windows #17

imagejan opened this issue Jan 4, 2016 · 34 comments
Labels

Comments

@imagejan
Copy link
Member

imagejan commented Jan 4, 2016

On Windows 7, running an up-to-date Fiji with Java 1.8.0_66 and the Java8 update site enabled, I get an empty gray canvas in the 3D viewer (when trying to display e.g. the Bat Cochlea Volume sample image), and the following stack trace is displayed in the console window:

3D [dev] 1.6.0-scijava-2-pre11-daily-experimental daily

com.jogamp.opengl.GLException: J3D-Renderer-1: createImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: GLProfile[GL4bc/GL4bc.hw], current: 1.1 (Compat profile, compat[], hardware) - 1.1.0
    at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:404)
    at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
    at org.scijava.java3d.JoglPipeline.createNewContext(JoglPipeline.java:6412)
    at org.scijava.java3d.Canvas3D.createNewContext(Canvas3D.java:4602)
    at org.scijava.java3d.Canvas3D.createNewContext(Canvas3D.java:2376)
    at org.scijava.java3d.Renderer.doWork(Renderer.java:881)
    at org.scijava.java3d.J3dThread.run(J3dThread.java:271)
Exception occurred in RenderingErrorListener:
java.lang.RuntimeException
    at ij3d.ImageWindow3D$ErrorListener.errorOccurred(ImageWindow3D.java:330)
    at org.scijava.java3d.VirtualUniverse.notifyRenderingErrorListeners(VirtualUniverse.java:1198)
    at org.scijava.java3d.NotificationThread.processNotifications(NotificationThread.java:86)
    at org.scijava.java3d.NotificationThread.run(NotificationThread.java:104)

This might be related to the graphics card, as I'm not seeing this problem on a different machine with different hardware. The 3D viewer used to work on that machine when running Java6, so it would be great to know if this can be sorted on Java8.

@ctrueden
Copy link
Member

ctrueden commented Jan 4, 2016

See also this forum post which discusses the same (and similar) errors. In that thread, the relevant system specs for this error are:

Graphics card: AMD Radeon 290
OS: Windows 10

@ctrueden
Copy link
Member

@imagejan Have you tried using ClearVolume on the affected system? If it works, that might be a suitable workaround. And we are moving in that direction these days anyway.

@imagejan
Copy link
Member Author

@ctrueden Finally I got a chance to test on the affected system:

ClearVolume (via the ClearVolume update site) works well on this system as long as the Java-8 update site is not enabled.
When both ClearVolume and Java-8 update sites are enabled,

  • CV will fail with
    • java.lang.UnsatisfiedLinkError: Can't load library: C:\Utilities\Fiji\natives\windows-amd64\\gluegen-rt.dll in the console
    • java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException in the log window
  • 3D Viewer will fail with
    • java.lang.NoClassDefFoundError: Could not initialize class com.jogamp.opengl.GLProfile in the log window

(but I think this issue is known to all involved parties)

@kephale
Copy link
Collaborator

kephale commented Jan 21, 2016

I think @royerloic finished a fix for this, but hasn't had a chance to get it on the ClearVolume update site yet.

@ctrueden
Copy link
Member

@ctrueden
Copy link
Member

@ctrueden
Copy link
Member

ctrueden commented May 31, 2016

For those affected by this bug: a developer on the JogAmp Java 3D forum posted the following suggestion:

Please run this program and post the result here.

You may have to add jogamp.org to the exception list to run it.

I did not run it (I do not have an affected system), but if anyone else has a few spare minutes to try, it might be helpful!

@imagejan
Copy link
Member Author

imagejan commented Jun 3, 2016

Here's the output from the affected PC:

-----------------------------------------------------------------------------------------------------
Platform: WINDOWS / Windows 7 6.1 (6.1.0), x86 (X86_32, GENERIC_ABI), 16 cores, littleEndian true
MachineDataInfo: runtimeValidated true, 32Bit true, primitive size / alignment:
  int8    1 / 1, int16   2 / 2
  int     4 / 4, long    4 / 4
  int32   4 / 4, int64   8 / 8
  float   4 / 4, double  8 / 8, ldouble 12 / 4
  pointer 4 / 4, page    4096
Platform: Java Version: 1.8.0_92 (1.8.0u92), VM: Java HotSpot(TM) Client VM, Runtime: Java(TM) SE Runtime Environment
Platform: Java Vendor: Oracle Corporation, http://java.oracle.com/, JavaSE: true, Java6: true, AWT enabled: true
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Package: com.jogamp.common
Extension Name: com.jogamp.common
Specification Title: GlueGen Java Bindings Generator
Specification Vendor: JogAmp Community
Specification Version: 2.3
Implementation Title: GlueGen Run-Time
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.3.2
Implementation Build: 2.3-b900-20151009
Implementation Branch: origin/master
Implementation Commit: cc1e9bc698b7f11097c1e114027e53121552f280
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Package: com.jogamp.opengl
Extension Name: com.jogamp.opengl
Specification Title: Java Bindings for OpenGL API Specification
Specification Vendor: JogAmp Community
Specification Version: 2.3
Implementation Title: Java Bindings for OpenGL Runtime Environment
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.3.2
Implementation Build: 2.3-b1469-20151010
Implementation Branch: origin/master
Implementation Commit: e794fc40ba723f2fca4ac892e873975fb393e007
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
WindowsGraphicsDevice[type .windows, connection decon]: 
    Natives
        GL4bc   true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31], FBO, hardware)]
        GL4     true [4.5 (Core profile, arb, compat[ES2, ES3, ES31], FBO, hardware)]
        GLES3   false
        GL3bc   true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31], FBO, hardware)]
        GL3     true [4.5 (Core profile, arb, compat[ES2, ES3, ES31], FBO, hardware)]
        GL2     true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31], FBO, hardware)]
        GLES2   false
        GLES1   false
        Count   5 / 8
    Common
        GL4ES3  true
        GL2GL3  true
        GL2ES2  true
        GL2ES1  true
    Mappings
        GL3bc   GLProfile[GL3bc/GL4bc.hw]
        GL2ES1  GLProfile[GL2ES1/GL4bc.hw]
        GL4ES3  GLProfile[GL4ES3/GL4.hw]
        GL2ES2  GLProfile[GL2ES2/GL4.hw]
        GL4bc   GLProfile[GL4bc/GL4bc.hw]
        GL2     GLProfile[GL2/GL4bc.hw]
        GL4     GLProfile[GL4/GL4.hw]
        GL3     GLProfile[GL3/GL4.hw]
        GL2GL3  GLProfile[GL2GL3/GL4bc.hw]
        default GLProfile[GL4bc/GL4bc.hw]
        Count   9 / 12

Swap Interval  1
GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.5 (Compat profile, arb, compat[ES2, ES3, ES31], FBO, hardware) - 4.5.13417 Compatibility Profile Context 15.301.1201.0 [GL 4.5.0, vendor 15.301.1201 (Compatibility Profile Context 15.301.1201.0)]
Quirks         [NoDoubleBufferedBitmap, NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      ATI Technologies Inc.
GL_RENDERER    AMD Radeon R9 200 / HD 7900 Series
GL_VERSION     4.5.13417 Compatibility Profile Context 15.301.1201.0
GLSL           true, has-compiler-func: true, version: 4.40 / 4.40.0
GL FBO: basic true, full true
GL_EXTENSIONS  283
GLX_EXTENSIONS 24
-----------------------------------------------------------------------------------------------------

@ctrueden
Copy link
Member

ctrueden commented Jun 3, 2016

There is a hack you can now try, to see whether it fixes the issue on your system:

  • Download it here.
  • Rename your old jars/j3dcore-1.6.0-scijava-2.jar to jars/j3dcore-1.6.0-scijava-2.jar.bak.
  • Drop the newly downloaded JAR into the jars folder.
  • Restart ImageJ and try the 3D Viewer.

ctrueden added a commit to scijava/java3d-core that referenced this issue Jun 3, 2016
Thanks to Philip Jordan; see discussion at:
http://forum.jogamp.org/Java-3D-crash-or-flickering-tp4035074p4036787.html

This temporary workaround may avoid certain problems in the 3D_Viewer:
* fiji/3D_Viewer#17
* fiji/3D_Viewer#18
@imagejan
Copy link
Member Author

imagejan commented Jun 3, 2016

@ctrueden this didn't fix it for me. I still get the following error message:

3D [dev] 1.6.0-scijava-3-SNAPSHOT-pre11-daily-experimental daily

com.jogamp.opengl.GLException: J3D-Renderer-1: createImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: GLProfile[GL4bc/GL4bc.hw], current: 1.1 (Compat profile, compat[], hardware) - 1.1.0
    at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:404)
    at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648)
    at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
    at org.scijava.java3d.JoglPipeline.createNewContext(JoglPipeline.java:6415)
    at org.scijava.java3d.Canvas3D.createNewContext(Canvas3D.java:4602)
    at org.scijava.java3d.Canvas3D.createNewContext(Canvas3D.java:2376)
    at org.scijava.java3d.Renderer.doWork(Renderer.java:881)
    at org.scijava.java3d.J3dThread.run(J3dThread.java:271)
J3dI18N: Error looking up: Renderer7
Exception occurred in RenderingErrorListener:
java.lang.RuntimeException
    at ij3d.ImageWindow3D$ErrorListener.errorOccurred(ImageWindow3D.java:330)
    at org.scijava.java3d.VirtualUniverse.notifyRenderingErrorListeners(VirtualUniverse.java:1198)
    at org.scijava.java3d.NotificationThread.processNotifications(NotificationThread.java:86)
    at org.scijava.java3d.NotificationThread.run(NotificationThread.java:104)
nFrames = 1

@ctrueden
Copy link
Member

ctrueden commented Jun 3, 2016

@imagejan Thanks for testing. Yes, same result for me. Hopefully @philjord will have additional ideas.

@philjord
Copy link

philjord commented Jun 3, 2016

Curtis,
Unfortunately this is all core openGL issues, of which I'm no expert, I've never encountered this arb but not arb message before adn GL2ES1 works fine on my machine.

My only thought is that the ES1 requirement is causing trouble so perhaps trying

profile = GLProfile.getGL2GL3();

might work, but I realise I'm just firing out ideas and what we need is some expert advice from Julien or Sven...

@aschain
Copy link

aschain commented Sep 8, 2016

I have a win 7 system,
Radeon HD 7500
OpenGL 4.5
JDK 1.8_0-101 ImageJ 1.51g

Not sure if this has been made explicit anywhere, as this bug is mentioned several times along with the property, but:

On my system, 3Dviewer will work if sun.java2d.noddraw=false.

Unfortunately you can't just pass -Dsun.java2d.noddraw=false to fiji-win64.exe because it gets overwritten by a later -Dsun.java2d.noddraw=true.
So I run the whole java startup string in the cmd line (pulled from running fiji-win64,exe in cmd), but take out the "-Dsun.java2d.noddraw=true". Something like:

javaw -Dpython.cachedir.skip=true -Dplugins.dir=C:\PATH\TO\Fiji.app -Xmx18398m -Xincgc -XX:PermSize=128m -Dsun.java.command=ImageJ -Djava.class.path=C:\PATH\TO\Fiji.app\jars\imagej-launcher-4.0.5.jar -Dimagej.dir=C:\PATH\TO\Fiji.app -Dij.dir=C:\PATH\TO\Fiji.app -Dfiji.dir=C:\PATH\TO\Fiji.app -Dfiji.defaultLibPath=bin\server\jvm.dll -Dfiji.executable=C:\PATH\TO\Fiji.app\fiji-win64.exe -Dij.executable=C:\PATH\TO\Fiji.app\fiji-win64.exe -Djava.library.path=C:\PATH\TO\Fiji.app\lib\win64 -Dsun.java2d.noddraw=false net.imagej.launcher.ClassLauncher -classpath C:\PATH\TO\Fiji.app\jars\ fiji.Main -port7

(Of course anyone who wants to try will have to pull their own string.)
Not sure if this is helpful, but there you go.

@tinevez
Copy link
Member

tinevez commented Sep 9, 2016

Hi @aschain

Does it work if you use the Fiji syntax to pass options to the JVM mentioned here?
http://imagej.net/Java_Options

@ctrueden
Copy link
Member

ctrueden commented Sep 9, 2016

Unfortunately you can't just pass -Dsun.java2d.noddraw=false to fiji-win64.exe because it gets overwritten by a later -Dsun.java2d.noddraw=true.

The culprit is here.

Because of this, I am guessing it cannot be overridden whatsoever.

However, it seems this is an obsolete system property now, replaced by the (inverted) sun.java2d.d3d property. So you could try setting that to true and see whether it works.

@tinevez
Copy link
Member

tinevez commented Sep 9, 2016

It does not.

@ctrueden
Copy link
Member

ctrueden commented Sep 9, 2016

Should I just remove that hardcoded property from the ImageJ launcher?

It was originally done to work around some Java 3D fullscreen bug ([1] + [2]). At this point it seems to do more harm than good though...

@tinevez
Copy link
Member

tinevez commented Sep 10, 2016

Ok let's go and see if we can give hope.

ctrueden added a commit to imagej/imagej-launcher that referenced this issue Sep 10, 2016
From @aschain:
> 3Dviewer will work if sun.java2d.noddraw=false.
>
> Unfortunately you can't just pass -Dsun.java2d.noddraw=false
> to fiji-win64.exe because it gets overwritten by a later
> -Dsun.java2d.noddraw=true.

See discussion at:
fiji/3D_Viewer#17 (comment)

Note that the property is obsolete now in any case:
> noddraw
>
> Obsoleted in: Java SE 6 Update 10, which contains a new implementation
> of D3D support. Setting sun.java2d.noddraw=true is now interpreted
> exactly the same as disabling that via sun.java2d.d3d=false.
> Intended use: To turn off the Java 2D system's use of DirectDraw and
> Direct3D completely.
> Introduced: 1.2
> Default value: false
> How to use: Setting this flag to true turns off DirectDraw usage,
> which sometimes helps to get rid of rendering problems on Win32.

https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html#noddraw
@ctrueden
Copy link
Member

ctrueden commented Sep 10, 2016

I removed it: imagej/imagej-launcher@6202e84.

Unfortunately, the ImageJ Jenkins Windows node is still down, so there will be no new Windows build of the launcher right now. @aneevel is actively working on restoring the node though, so we will hopefully have a build by end of next week. In the meantime, someone with a Windows developer setup could build it themselves and post a binary for community testing.

@aschain
Copy link

aschain commented Nov 2, 2016

I compiled the new imagej-launcher and renamed to fiji-win64.exe and replaced the imagej.ico with the fiji one. It's here: http://sites.imagej.net/Aschain/fiji-win64.exe-20161102105633
In order to compile I had to remove a "sleep" command that caused an error, so the version I compiled is at github.com/aschain/imagej-launcher

@urslu
Copy link

urslu commented Nov 25, 2016

Without really being able to provide any help to solve the problem I just wanted to let you know that the launcher provided by @aschain seems to solve the issue for me. I don't get the error anymore and the 3D Viewer launches. Thank you.

@haesleinhuepf
Copy link

@aschain I tried your launcher on my system (Win7, ATI FirePro V8800) and IT WORKS fine! Could you please file a pull request to the developers? Thank you so much for this solution!

@imagejan
Copy link
Member Author

Could you please file a pull request to the developers?

A pull request is not required, as the fix by @ctrueden is already on the master branch. All that's needed is uploading it to the official update site, now that you guys tested it.

@ctrueden
Copy link
Member

Thanks very much for posting the build, @aschain!
Thanks very much for testing, @urslu and @haesleinhuepf!
Thanks very much for the reminder, @imagejan!

The good news is that the Windows Jenkins node is back up and running.

The bad news is that when I triggered a build of the latest ImageJ Launcher right now, it failed on all platforms. I fear it will take some time for me to investigate and fix. I've added it to my to-do list.

@ctrueden
Copy link
Member

I also want to mention that the new JogAmp Java 3D maintainer, @philjord, has also been investigating these issues, and recently posted more discoveries on the JogAmp forum. In particular, it seems that setting the property sun.awt.nopixfmt to true also fixes these problems... maybe not necessary now that the ImageJ Launcher won't set sun.java2d.noddraw anymore, but just wanted to mention it for completeness here.

@ctrueden
Copy link
Member

Quick update: I really want to build and deploy the new ImageJ launcher. I am reluctant to deploy the build linked above because it has been conflated with fiji-win64.exe (which previously simply delegated to ImageJ-win64.exe). However, for several reasons, we have now abandoned our Windows Jenkins node. The hope is to do Windows builds on a cloud CI now instead. I started looking at doing the Windows build on AppVeyor but that is new territory for me and setting up the appveyor.yml to call Maven will require me to absorb a significant amount of documentation first. If anyone else has time to play with it, you can file a PR adding an appveyor.yml to imagej/imagej-launcher and I will merge and we'll see what happens here.

@aschain
Copy link

aschain commented Mar 3, 2017

I compiled the imagej-launcher in the more classic way here (it has the regular imageJ icon, and I renamed it ImageJ-win64.exe not Fiji). In case it helps in the meantime.
BTW is there a better way to compile the Fiji launcher?

@ctrueden
Copy link
Member

ctrueden commented Mar 6, 2017

I compiled the imagej-launcher in the more classic way here

Huge thanks, @aschain! I have now uploaded this to the core ImageJ update site, so that everyone can enjoy it.

Could someone (anyone!) paying attention to this thread, who suffers from this issue, confirm that the problem is now solved on your system? If so, I will close this issue.

BTW is there a better way to compile the Fiji launcher?

Like I said, you shouldn't have to—it is a very thin wrapper which simply delegates to ImageJ-win64.exe. It has been so long since Johannes did that that I honestly forgot (or never know) how it was created, sorry.

@royerloic
Copy link

royerloic commented Mar 6, 2017 via email

@ctrueden
Copy link
Member

Could someone (anyone!) paying attention to this thread, who suffers from this issue, confirm that the problem is now solved on your system? If so, I will close this issue.

Just to repeat my request: could some Windows user please confirm that an up-to-date Fiji no longer has this issue?

@tinevez
Copy link
Member

tinevez commented Mar 14, 2017

Tested on windows 10.

  • flybrain + 3D viewer works normally
  • TrackMate 3D over time data works as expected.
    Hooooray!

@ctrueden
Copy link
Member

ctrueden commented Mar 14, 2017

Thank you for following up, @tinevez, and many apologies that this issue stayed open for so long after the fix was discovered.

And thanks again to @aschain for compiling the binary.

@MrLoh
Copy link

MrLoh commented Apr 3, 2017

Sorry, I'm new to imageJ and trying to track down this issue for my wife. Where can I download the latest version that @ctrueden mentioned that fixes the problem? Thanks a lot for the help.

@ctrueden
Copy link
Member

ctrueden commented Apr 3, 2017

@MrLoh It should be included with the latest Fiji Win64 download. Or you can run Help ▶ Update... to receive the fix, as long as you are using Java 8. The latest ImageJ-win64.exe includes the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants