Git Product home page Git Product logo

jogl's People

Contributors

barcsikattila avatar demoscenepassivist avatar elect86 avatar esemplare avatar gohai avatar hharrison avatar hharrison-mce avatar io7m avatar juankprada avatar kenrussell avatar letmaik avatar mbien avatar michaelhermannweber avatar olamedia avatar petr-s avatar ph0b avatar pissedcapslock avatar rhatcher avatar rothwell avatar rsantina avatar sgothel avatar sylvestre avatar tek206 avatar thederingsimus avatar tomnuydens avatar toruwest avatar utgarda avatar wadewalker avatar wamei avatar xranby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jogl's Issues

Incorrect GL Version - Win10 + Nvidia + JDK 8

https://forum.jogamp.org/Incorrect-context-on-GLCanvas-drawable-td4041391.html

This test program (see below) simply creates a JFrame on the default GraphicsConfiguration for my first screen, and adds an empty GLCanvas to this JFrame.
While creating the GUI, this test program enumerates all GraphicsDevice's available on my PC, and for each GraphicsDevice, all available GraphicsConfigurations.
Finally, in the init() callback of my GLEventListener, I simply print the GLVersion of my drawable.getContext().

On my Windows 10 development PC, which has two screens attached to a NVIDIA GeForce GTX 1060 6 GB graphics adapter, here is what I get on the stdout:

Screen device # 0: \Display0
Screen device # 0, configuration # 0:
Screen device # 1: \Display1
Screen device # 1, configuration # 0:
NewFrame created in thread [15], isEDT: true
* Context GL version: 4.6 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware) - 4.6.0 NVIDIA 456.71

So far, so good. In my init() callback, I get an OpenGL 4.6 context, and that's great. VTK would work fine with such a context.

However, if I just pass "-Dsun.java2d.noddraw=true" system property to my JVM (which is required to run both JOGL and my application smoothly), here is what I get:

Screen device # 0: \Display0
Screen device # 0, configuration # 0:
Screen device # 0, configuration # 1:
Screen device # 0, configuration # 2:
Screen device # 0, configuration # 3:
Screen device # 0, configuration # 4:
Screen device # 0, configuration # 5:
Screen device # 1: \Display1
Screen device # 1, configuration # 0:
Screen device # 1, configuration # 1:
Screen device # 1, configuration # 2:
Screen device # 1, configuration # 3:
Screen device # 1, configuration # 4:
Screen device # 1, configuration # 5:
NewFrame created in thread [15], isEDT: true
*** Context GL version: 1.1 (Compat profile, arb, compat[], FBO, hardware) - 1.1.0**

As you can see, with this system property, first of all I get 6 different GraphicsConfiguration per each screen (I am uncertain why, but this certainly doesn't depend on JOGL), and then the GLContext I get in my init() callback is an OpenGL 1.1 context (and I believe this depends on JOGL and shouldn't happen)!

Even stranger, if in my test case code I simply remove the call to GraphicsDevice.getConfigurations() (but always passing "-Dsun.java2d.noddraw=true"), then again I am getting a correct OpenGL 4.6 context. Here is the output I obtain in this last test configuration:

NewFrame created in thread [15], isEDT: true
* Context GL version: 4.6 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware) - 4.6.0 NVIDIA 456.71

I looks like the fact that I call GraphicsDevice.getConfigurations() (which apparently should do nothing) is changing something in the way JOGL creates its GLContext in the GLCanvas.

I would really appreciate your feedback, now that I've been able to put together a complete and very simple test case.

package vtk.sample.rendering;

import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;


public class JoglContextTestCase
{
  private static JFrame mainFrame = null;
  
  private static void buildSceneAndCheckConfigurations()
  {
    GraphicsEnvironment graphEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] graphDevsOrig = graphEnv.getScreenDevices();
    
    
    GraphicsConfiguration gcDef = graphDevsOrig[0].getDefaultConfiguration();
    
    // *************************************************************************
    // NOTE: if I comment the following loop, which apparently does NOTHING
    // (except calling .getGraphicsConfigurations()), this test case
    // returns "GL version: 4.6" on my PC, while with the following loop
    // uncommented, it returns "GL version: 1.1" --> this would cause VTK
    // to CRASH!
    // The single call responsible for the "GL 1.1" issue, for some reason,
    // seems to be 'graphDevsOrig[i].getConfigurations();'
    // *************************************************************************    
    for (int i = 0; i < graphDevsOrig.length; i++)
    {
      System.out.println("Screen device # " + i + ": " + graphDevsOrig[i].getIDstring());
      GraphicsConfiguration[] graphConfs = graphDevsOrig[i].getConfigurations();

      for (int j = 0; j < graphConfs.length; j++)
      {
        System.out.println("Screen device # " + i + ", configuration # " + j + ":");
      }
    }
    
    buildScene(gcDef);    
  }
  
  private static void buildScene(GraphicsConfiguration graphConf)
  {
    GLCanvas glCanvas = new GLCanvas(new GLCapabilities(GLProfile.getMaximum(true)));
    glCanvas.addGLEventListener(new GLEventListener()
    {
      @Override
      public void init(final GLAutoDrawable drawable)
      {
//        final GL gl = drawable.getGL();
//        System.out.println(JoglVersion.getGLInfo(gl, null));
//        System.out.println("* Context = " + drawable.getContext().toString());
        System.out.println("* Context GL version: " + drawable.getContext().getGLVersion());
      }

      @Override
      public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
      {
      }

      @Override
      public void display(final GLAutoDrawable drawable)
      {
      }

      @Override
      public void dispose(final GLAutoDrawable drawable)
      {
      }
    });
    
    // UI part
    mainFrame = new JFrame("SimpleVTK", graphConf);
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.getContentPane().setLayout(new BorderLayout());
    
    mainFrame.setSize(1000, 600);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.setVisible(true);
    mainFrame.getContentPane().add(glCanvas, BorderLayout.CENTER);
    glCanvas.requestFocus();
    
    
    System.out.println("NewFrame created in thread [" + Thread.currentThread().getId() + "], isEDT: " + SwingUtilities.isEventDispatchThread());
  }

  public static void main(String[] args)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        buildSceneAndCheckConfigurations();
      }
    });
  }
}

EGLGLXDrawableFactory - Could not initialize shared resources for EGLGraphicsDevice[type .egl, v1.4.0, connection decon, unitID 0, handle 0x1bf7963a070, owner true, NullToolkitLock[obj 0xe8146cb]]

Only appears in Windows 10 Pro 64bit, Graphics card QUADRO P400.
Using GL driver: Context GL version: 4.6 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware) - 4.6.0 NVIDIA 462.96

DemoAxisLabelLayout_Native
Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for EGLGraphicsDevice[type .egl, v1.4.0, connection decon, unitID 0, handle 0x1bf7963a070, owner true, NullToolkitLock[obj 0xe8146cb]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:561)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.base/java.lang.Thread.run(Thread.java:832)
Caused[0] by GLException: Graphics configuration failed [direct caps, eglGetConfig/chooser and fixed-caps(1-3)] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(EGLGraphicsConfigurationFactory.java:351)
    [1]: jogamp.opengl.egl.EGLDrawableFactory.evalConfig(EGLDrawableFactory.java:1121)
    [2]: jogamp.opengl.egl.EGLDrawableFactory.createSurfacelessImpl(EGLDrawableFactory.java:1166)
    [3]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.mapAvailableEGLESConfig(EGLDrawableFactory.java:753)
    [4]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:656)
    [5]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:559)
    [6]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [7]: java.base/java.lang.Thread.run(Thread.java:832)
Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0xe8146cb]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:561)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.base/java.lang.Thread.run(Thread.java:832)
Caused[0] by InternalError: XXX: defaultDevice EGLGraphicsDevice[type .egl, v1.4.0, connection decon, unitID 0, handle 0x1bf7963a070, owner true, NullToolkitLock[obj 0xe8146cb]], adevice WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0xe8146cb]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:606)
    [1]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:559)
    [2]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [3]: java.base/java.lang.Thread.run(Thread.java:832)

Let's remind the drawable factory hierarchy :
image

This page is a good explanation of what EGL is w.r.t CGL (macOS) WGL (Windows) and GLX (Linux).

There are existing problems discussed in JOGL forum regarding EGL

NativeWindowFactory.initSingleton()

in one of my projects, the thread executing NativeWindowFactory.initSingleton() received an interrupt .

in NativeWindowFactory.initSingleton(), the static field "initialized" is set to true at the beginning of the method but no "try catch" is done to verify if the init is successfull

Support SWT 4.21

Initial report in JOGL forum :

We updated the target platform to 2021-09 for our Eclipse RCP application that uses JOGL (via Jzy3d) and found an issue.

When JOGL's SWTAccessor class is loaded (for a NewtCanvasSWT or GLCanvas), it initializes some field to point to methods in SWT's internal classes. The recent release of SWT 4.21 separated some gtk methods off to gtk3 and gtk4 specific bindings. This breaks the initialization code when looking for gtk_widget_get_window.

---8<---
--- SWTAccessor.java.orig 2022-02-16 10:22:07.702204475 +0000
+++ SWTAccessor.java 2022-02-16 10:25:38.589674850 +0000
@@ -95,6 +95,7 @@
 
     private static final String str_OS_gtk_class = "org.eclipse.swt.internal.gtk.OS";    // used by earlier versions of SWT
     private static final String str_GTK_gtk_class = "org.eclipse.swt.internal.gtk.GTK";  // used by later versions of SWT
+    private static final String str_GTK3_gtk_class = "org.eclipse.swt.internal.gtk3.GTK3";  // used by later versions of SWT (4.21+)
     private static final String str_GDK_gtk_class = "org.eclipse.swt.internal.gtk.GDK";  // used by later versions of SWT
     public static final Class<?> OS_gtk_class;
     private static final String str_OS_gtk_version = "GTK_VERSION";
@@ -124,6 +125,8 @@
     private static final String str_gdk_window_set_back_pixmap = "gdk_window_set_back_pixmap";
     private static final String str_gdk_window_set_background_pattern = "gdk_window_set_background_pattern";
 
+    private static final int SWT_VERSION_4_21 = 4946;
+
     private static final VersionNumber GTK_VERSION_2_14_0 = new VersionNumber(2, 14, 0);
     private static final VersionNumber GTK_VERSION_2_24_0 = new VersionNumber(2, 24, 0);
     private static final VersionNumber GTK_VERSION_2_90_0 = new VersionNumber(2, 90, 0);
@@ -261,7 +264,12 @@
                 _gtk_version = GTK_VERSION(field_OS_gtk_version.getInt(null));
                 m1 = cGTK.getDeclaredMethod(str_gtk_widget_realize, handleType);
                 if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) {
-                    m4 = cGTK.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+                    if (SWT.getVersion() < SWT_VERSION_4_21) {
+                        m4 = cGTK.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+                    } else {
+                        Class<?> cGTK3 = ReflectionUtil.getClass(str_GTK3_gtk_class, false, cl);
+                        m4 = cGTK3.getDeclaredMethod(str_gtk_widget_get_window, handleType);
+                    }
                 } else {
                     m3 = cGTK.getDeclaredMethod(str_GTK_WIDGET_WINDOW, handleType);
                 }
---8<---

UnsatisfiedLinkError with jzy3d builds only

(Possibly related to #21 )

Arch Linux on amd64
Both openJDK and Temurin builds for JDK11 and JDK17
Both rc-20210111 and rc4 builds of jogl

When using artifacts from the jzy3d repository, I consistently get java.lang.UnsatisfiedLinkError: Can't load library: /mnt/develop/Shared/Source/ArtOfIllusion/natives/linux-amd64/libgluegen_rt.so

Note: the path returned is consistently ${user.dir}/natives/linux-amd64/libgluegen_rt.so no matter where I run the launch command. That is, it's looking under the directory where I'm running my shell.

Persists whether I leave the downloaded natives .jar named as-is, or rename to gluegen-rt-natives-linux-amd64 (without the version coding)

gluegen-rt.jar and jogl-all.jar are on the classpath, but the native jars are not. (They are in the same directory) Classpath is specified in the application main jar.

This is specific to the jzy3d artifacts. If I use the version directly downloaded from https://jogamp.org/deployment/archive/rc/v2.4.0-rc-20210111/jar/ , it loads and runs properly.

UnsatisfiedLinkError: Can't load library (nativewindow_awt, or other libs than gluegen)

Depending on your code, the GLProfile class gets never called which prevent the JOGL jar from being expanded.

A possible fix is to invoke GLProfile.initSingleton(); at the beginning of your program. This will force the jars to be expanded and then you do not miss any lib.

How to debug native library loading issues

  • Enabling -Djogamp.debug.JarUtil -Djogamp.debug.JNILibLoader will display the jar extraction and native libs loading
  • The first to be mentioned in console should be Gluegen.
  • Find something looking like : JarUtil: EXTRACT[1]: [gluegen_rt -> ] natives/macosx-universal/libgluegen_rt.dylib -> /var/folders/d2/85g_sxm91rg71yyky4gg6l6h0000gn/T/jogamp_0000/file_cache/jln7779685231866426360/jln1167618764182536803/natives/macosx-universal/libgluegen_rt.dylib: 85840 bytes, addedAsNativeLib: true
  • Search if the folder containing libgluegen_rt.dylib if it also contains other dylibs. There should be 6 including gluegen.

Classes triggering jar expansions

For JOGL developers :

  • gluegen : Platform.java (static initializer calls JNILoaderBase.addNativeJarLibs)
  • jogl : GLProfile.java (if not, call GLProfile.initSingleton();)
  • NWJNILibLoader, NewtJNILibLoader, etc

Interference/timing(?) issue on macOS when creating and destroying GLCanvas

Initially discussed here.

One of our mac users has recently been helping troubleshoot issues that we've had with our macOS package. They identified two situations where creating and/or destroying a GLJPanel in close proximity to other AWT/Swing-ish commands will cause the application to hang with, so far, no known error messages.

The test system in question is running Big Sur with OpenJDK-17.0.1
These are distilled-down versions. If the code looks odd, it's because we have clipped out all the application-specific context for why these operations are done in this order.

We speculate that there may be a timing component because wrapping some of the operations in nested SwingUtilities.invokeLater() will allow the application to proceed without hanging.

import com.jogamp.opengl.awt.GLJPanel;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class MaximizeTest2 {

JFrame f;  
GLJPanel canvas;
JPanel p;

  public MaximizeTest2() {
    newWindow();
  }

  public void newWindow() {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        f = new JFrame("test frame maximized both ");

        f.setExtendedState(JFrame.MAXIMIZED_BOTH); //This call is about the only thing that reliably
        f.setVisible(true);                                                    //triggers this behavior, but it actually came
                                                                                        //up in the real application
        p = new JPanel();
        canvas = new GLJPanel();
        //p.add(canvas); //Note: It does not seem to matter if canvas is added to the panel or not.
        f.setContentPane(p);
        f.validate();

        System.out.println("yyyy");
      }
    });
  }


  public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("xxxx");
      new MaximizeTest2();
    System.out.println("zzzz");
  }
}

Reproduced with the following JDK on MacOS

  • Azul JDK 17 for ARM
  • OpenJDK 17 (Rosetta might be involved to run on ARM)
  • OpenJDK 11 (Rosetta as well)

Compatibility matrix for JOGL 2.4 rc4

OS, GPU, CPU and JDK versions tested with JOGL 2.4 rc4

Capture d’écran 2022-03-22 à 16 08 10

This table can be found here to access all ticket links.

Summary of issues and workaround encountered with JOGL 2.4 rc4

Capture d’écran 2022-03-22 à 16 13 06

This table can be found here to access all ticket links.

GL2 -> profileImpl GL3bc !!! not mapped

Somehow JOGL can't map an implementation to the OpenGL version it does detect. Looking for GL3bc means JOGL assume your hadware supports OpenGL 3 and is in backward compatible mode.

Debugging

  • Run glxinfo command on the terminal to check which OpenGL version your hardware claim.
  • Call GLProfile.getMaximum(true) instead of GLProfile.getDefault() OR GLProfile.get("your OpenGL version") (which is definetely not portable but at least help understanding your situation).
  • There is an option to avoid entering the backward compatible mode which is : -Djogl.disable.openglcore=true this partially resolved the problem for me some time ago.

Useful discussions in forum

WorldWind get a JVM crash on Debian 5.10

Sonicblow said on Jogamp forum

i did try to use JOGL-2.4.0-rc4 with my worldwind app, but there are constantly jvm crashes on debian 5.10 and integrated video from i5-10210U

Mesa Intel(R) UHD Graphics (CML GT2)
4.6 (Compatibility Profile) Mesa 20.3.3

some version of 2.4.0 jars from worldwind github works fine (https://github.com/NASAWorldWind/WorldWindJava)

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000730ec7fb6764, pid=6935, tid=6971
#
# JRE version: OpenJDK Runtime Environment (17.0.2+9) (build 17.0.2+9-LTS)
# Java VM: OpenJDK 64-Bit Server VM (17.0.2+9-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libc.so.6+0x15c764]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bell-sw.com/support
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: -XX:MinRAMPercentage=15 -XX:MaxRAMPercentage=75 -XX:+UseGCOverheadLimit -XX:+CrashOnOutOfMemoryError -Dfile.encoding=UTF8 --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.desktop/java.awt.geom=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED --add-opens=java.desktop/javax.swing.table=ALL-UNNAMED --add-opens=java.desktop/com.sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.swing=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED --add-opens=java.desktop/com.apple.laf=ALL-UNNAMED 

Host: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 8 cores, 15G, Debian 5.10 x86-64
Time: Fri Jan 28 10:26:42 2022 MSK elapsed time: 47.761481 seconds (0d 0h 0m 47s)

---------------  T H R E A D  ---------------

Current thread (0x0000730eb8c04e60):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=6971, stack(0x0000730e3603b000,0x0000730e3613c000)]

Stack: [0x0000730e3603b000,0x0000730e3613c000],  sp=0x0000730e36138a28,  free space=1014k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x15c764]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 7883  jogamp.opengl.gl4.GL4bcImpl.dispatch_glReadPixels1(IIIIIILjava/lang/Object;IZJ)V (0 bytes) @ 0x0000730ea7edcc21 [0x0000730ea7edcba0+0x0000000000000081]
J 7881 c1 jogamp.opengl.gl4.GL4bcImpl.glReadPixels(IIIIIILjava/nio/Buffer;)V (121 bytes) @ 0x0000730ea1477a54 [0x0000730ea1477000+0x0000000000000a54]
J 7880 c1 gov.nasa.worldwind.render.DrawContextImpl.getPickColorAtPoint(Ljava/awt/Point;)I (177 bytes) @ 0x0000730ea1475314 [0x0000730ea1474600+0x0000000000000d14]
J 8017 c1 gov.nasa.worldwind.pick.PickSupport.getTopObject(Lgov/nasa/worldwind/render/DrawContext;Ljava/awt/Point;)Lgov/nasa/worldwind/pick/PickedObject; (53 bytes) @ 0x0000730ea14dac44 [0x0000730ea14da860+0x00000000000003e4]
J 8531 c1 gov.nasa.worldwind.terrain.SectorGeometryList.pick(Lgov/nasa/worldwind/render/DrawContext;Ljava/util/List;)Ljava/util/List; (577 bytes) @ 0x0000730ea1670e64 [0x0000730ea166f0c0+0x0000000000001da4]
j  gov.nasa.worldwind.AbstractSceneController.pickTerrain(Lgov/nasa/worldwind/render/DrawContext;)V+120
j  gov.nasa.worldwind.AbstractSceneController.pick(Lgov/nasa/worldwind/render/DrawContext;)V+26
j  gov.nasa.worldwind.BasicSceneController.doNormalRepaint(Lgov/nasa/worldwind/render/DrawContext;)V+27
j  gov.nasa.worldwind.BasicSceneController.doRepaint(Lgov/nasa/worldwind/render/DrawContext;)V+44
J 9240 c1 gov.nasa.worldwind.AbstractSceneController.repaint()I (408 bytes) @ 0x0000730ea1888504 [0x0000730ea1887f60+0x00000000000005a4]
J 9237 c1 gov.nasa.worldwind.WorldWindowGLAutoDrawable.display(Lcom/jogamp/opengl/GLAutoDrawable;)V (540 bytes) @ 0x0000730ea187bf8c [0x0000730ea187a020+0x0000000000001f6c]
J 9236 c1 jogamp.opengl.GLDrawableHelper.displayImpl(Lcom/jogamp/opengl/GLAutoDrawable;)V (86 bytes) @ 0x0000730ea187889c [0x0000730ea1878060+0x000000000000083c]
J 8961 c1 com.jogamp.opengl.awt.GLCanvas$11.run()V (122 bytes) @ 0x0000730ea17a435c [0x0000730ea17a3d60+0x00000000000005fc]
J 10430 c1 jogamp.opengl.GLDrawableHelper.invokeGLImpl(Lcom/jogamp/opengl/GLDrawable;Lcom/jogamp/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V (579 bytes) @ 0x0000730ea1311084 [0x0000730ea1310560+0x0000000000000b24]
J 10429 c1 jogamp.opengl.GLDrawableHelper.invokeGL(Lcom/jogamp/opengl/GLDrawable;Lcom/jogamp/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V (76 bytes) @ 0x0000730ea097287c [0x0000730ea09727c0+0x00000000000000bc]
J 10425 c1 com.jogamp.opengl.awt.GLCanvas$12.run()V (126 bytes) @ 0x0000730ea08e3954 [0x0000730ea08e3400+0x0000000000000554]
J 9235 c1 com.jogamp.opengl.awt.GLCanvas.display()V (68 bytes) @ 0x0000730ea18779b4 [0x0000730ea1877640+0x0000000000000374]
J 9233 c1 com.jogamp.opengl.awt.GLCanvas.paint(Ljava/awt/Graphics;)V (141 bytes) @ 0x0000730ea187606c [0x0000730ea1875380+0x0000000000000cec]
J 9232 c1 gov.nasa.worldwind.awt.WorldWindowGLCanvas.paint(Ljava/awt/Graphics;)V (13 bytes) @ 0x0000730ea1874e04 [0x0000730ea1874d40+0x00000000000000c4]
J 10453 c1 com.jogamp.opengl.awt.GLCanvas.update(Ljava/awt/Graphics;)V (6 bytes) @ 0x0000730ea0f1bbbc [0x0000730ea0f1bac0+0x00000000000000fc]
J 10451 c1 sun.awt.X11.XRepaintArea.updateComponent(Ljava/awt/Component;Ljava/awt/Graphics;)V [email protected] (11 bytes) @ 0x0000730ea0932b7c [0x0000730ea09329c0+0x00000000000001bc]
J 9069 c1 sun.awt.RepaintArea.paint(Ljava/lang/Object;Z)V [email protected] (354 bytes) @ 0x0000730ea17fffec [0x0000730ea17ff0e0+0x0000000000000f0c]
J 7812 c1 sun.awt.X11.XComponentPeer.handleEvent(Ljava/awt/AWTEvent;)V [email protected] (245 bytes) @ 0x0000730ea144afac [0x0000730ea14495e0+0x00000000000019cc]
J 7438 c1 java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V [email protected] (777 bytes) @ 0x0000730ea134639c [0x0000730ea1341160+0x000000000000523c]
J 9873 c2 java.awt.EventQueue$4.run()Ljava/lang/Object; [email protected] (5 bytes) @ 0x0000730ea804fbcc [0x0000730ea804f6e0+0x00000000000004ec]
J 9713 c2 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V [email protected] (80 bytes) @ 0x0000730ea801cd6c [0x0000730ea801c8e0+0x000000000000048c]
J 10953 c2 java.awt.EventDispatchThread.pumpOneEventForFilters(I)V [email protected] (113 bytes) @ 0x0000730ea81715e0 [0x0000730ea81711e0+0x0000000000000400]
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 [email protected]
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 [email protected]
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 [email protected]
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 [email protected]
j  java.awt.EventDispatchThread.run()V+9 [email protected]
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000730dcc6de268

Register to memory mapping:

RAX=0x0000730e14d6f908 points into unknown readable memory: 0x0000730e140006c0 | c0 06 00 14 0e 73 00 00
RBX=0x0000000000000200 is an unknown value
RCX=0x0 is NULL
RDX=0x0000000000000004 is an unknown value
RSP=0x0000730e36138a28 is pointing into the stack for thread: 0x0000730eb8c04e60
RBP=0x000000000000006c is an unknown value
RSI=0x0000730dcc6de268 is an unknown value
RDI=0x0000730e14d6f908 points into unknown readable memory: 0x0000730e140006c0 | c0 06 00 14 0e 73 00 00
R8 =0x0000000000000001 is an unknown value
R9 =0x0000000000000400 is an unknown value
R10=0x0000730e14d6f8a0 points into unknown readable memory: 0x00000000b2da2033 | 33 20 da b2 00 00 00 00
R11=0x0000000000000062 is an unknown value
R12=0x000000000000006c is an unknown value
R13=0x0000730dcc6de000 is an unknown value
R14=0x000000000000006c is an unknown value
R15=0x0000730e14d6f8a0 points into unknown readable memory: 0x00000000b2da2033 | 33 20 da b2 00 00 00 00


Registers:
RAX=0x0000730e14d6f908, RBX=0x0000000000000200, RCX=0x0000000000000000, RDX=0x0000000000000004
RSP=0x0000730e36138a28, RBP=0x000000000000006c, RSI=0x0000730dcc6de268, RDI=0x0000730e14d6f908
R8 =0x0000000000000001, R9 =0x0000000000000400, R10=0x0000730e14d6f8a0, R11=0x0000000000000062
R12=0x000000000000006c, R13=0x0000730dcc6de000, R14=0x000000000000006c, R15=0x0000730e14d6f8a0
RIP=0x0000730ec7fb6764, EFLAGS=0x0000000000010246, CSGSFS=0x002b000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x0000730e36138a28)
0x0000730e36138a28:   0000730ddeecc696 0000000000000046
0x0000730e36138a38:   0000000000000068 0000000000000000
0x0000730e36138a48:   0000730d00000400 0000000000001400
0x0000730e36138a58:   0000000000000000 0000000000000068 

Instructions: (pc=0x0000730ec7fb6764)
0x0000730ec7fb6664:   82 c7 c2 fa ff 0f 1f 80 00 00 00 00 48 89 f8 48
0x0000730ec7fb6674:   83 fa 20 0f 82 a5 00 00 00 48 83 fa 40 0f 87 08
0x0000730ec7fb6684:   01 00 00 c5 fe 6f 06 c5 fe 6f 4c 16 e0 c5 fe 7f
0x0000730ec7fb6694:   07 c5 fe 7f 4c 17 e0 c5 f8 77 c3 90 48 39 d1 0f
0x0000730ec7fb66a4:   82 87 c2 fa ff 0f 1f 80 00 00 00 00 48 89 f8 48
0x0000730ec7fb66b4:   01 d0 eb 1b 0f 1f 84 00 00 00 00 00 48 39 d1 0f
0x0000730ec7fb66c4:   82 67 c2 fa ff 0f 1f 80 00 00 00 00 48 89 f8 48
0x0000730ec7fb66d4:   83 fa 20 72 49 48 83 fa 40 0f 87 9f 00 00 00 c5
0x0000730ec7fb66e4:   fe 6f 06 c5 fe 6f 4c 16 e0 c5 fe 7f 07 c5 fe 7f
0x0000730ec7fb66f4:   4c 17 e0 c5 f8 77 c3 48 3b 15 76 3d 06 00 0f 83
0x0000730ec7fb6704:   25 01 00 00 48 39 f7 72 0f 74 12 4c 8d 0c 16 4c
0x0000730ec7fb6714:   39 cf 0f 82 c5 01 00 00 48 89 d1 f3 a4 c3 80 fa
0x0000730ec7fb6724:   10 73 17 80 fa 08 73 27 80 fa 04 73 33 80 fa 01
0x0000730ec7fb6734:   77 3b 72 05 0f b6 0e 88 0f c3 c5 fa 6f 06 c5 fa
0x0000730ec7fb6744:   6f 4c 16 f0 c5 fa 7f 07 c5 fa 7f 4c 17 f0 c3 48
0x0000730ec7fb6754:   8b 4c 16 f8 48 8b 36 48 89 4c 17 f8 48 89 37 c3
0x0000730ec7fb6764:   8b 4c 16 fc 8b 36 89 4c 17 fc 89 37 c3 0f b7 4c
0x0000730ec7fb6774:   16 fe 0f b7 36 66 89 4c 17 fe 66 89 37 c3 48 81
0x0000730ec7fb6784:   fa 00 10 00 00 0f 87 6c ff ff ff 48 81 fa 00 01
0x0000730ec7fb6794:   00 00 0f 87 91 00 00 00 48 81 fa 80 00 00 00 72
0x0000730ec7fb67a4:   5a c5 fe 6f 06 c5 fe 6f 4e 20 c5 fe 6f 56 40 c5
0x0000730ec7fb67b4:   fe 6f 5e 60 c5 fe 6f 64 16 e0 c5 fe 6f 6c 16 c0
0x0000730ec7fb67c4:   c5 fe 6f 74 16 a0 c5 fe 6f 7c 16 80 c5 fe 7f 07
0x0000730ec7fb67d4:   c5 fe 7f 4f 20 c5 fe 7f 57 40 c5 fe 7f 5f 60 c5
0x0000730ec7fb67e4:   fe 7f 64 17 e0 c5 fe 7f 6c 17 c0 c5 fe 7f 74 17
0x0000730ec7fb67f4:   a0 c5 fe 7f 7c 17 80 c5 f8 77 c3 c5 fe 6f 06 c5
0x0000730ec7fb6804:   fe 6f 4e 20 c5 fe 6f 54 16 e0 c5 fe 6f 5c 16 c0
0x0000730ec7fb6814:   c5 fe 7f 07 c5 fe 7f 4f 20 c5 fe 7f 54 17 e0 c5
0x0000730ec7fb6824:   fe 7f 5c 17 c0 c5 f8 77 c3 48 39 f7 0f 87 ab 00
0x0000730ec7fb6834:   00 00 0f 84 e5 fe ff ff c5 fe 6f 26 c5 fe 6f 6c
0x0000730ec7fb6844:   16 e0 c5 fe 6f 74 16 c0 c5 fe 6f 7c 16 a0 c5 7e
0x0000730ec7fb6854:   6f 44 16 80 49 89 fb 48 8d 4c 17 e0 49 89 f8 49 


Stack slot to memory mapping:
stack at sp + 0 slots: 0x0000730ddeecc696: <offset 0x0000000000e28696> in /usr/lib/x86_64-linux-gnu/dri/iris_dri.so at 0x0000730dde0a4000
stack at sp + 1 slots: 0x0000000000000046 is an unknown value
stack at sp + 2 slots: 0x0000000000000068 is an unknown value
stack at sp + 3 slots: 0x0 is NULL
stack at sp + 4 slots: 0x0000730d00000400 is an unknown value
stack at sp + 5 slots: 0x0000000000001400 is an unknown value
stack at sp + 6 slots: 0x0 is NULL
stack at sp + 7 slots: 0x0000000000000068 is an unknown value

JOGL 2.4rc4 + JDK Temurin 17.02+8 + SWT 4.23 + macOS + ARM Processor = Crash w/o exception

Hi,

I've tried a rather adventurous combination (which is the one we are currently supporting for GAMA -- https://github.com/gama-platform/gama) and it crashed, which is disappointing, especially because I am unable to determine what makes it crash.

The goal was to go "all native": the JDK is native, Eclipse is the native aarch64 version (and SWT is a native binary), and I used the JOGL version (2.4rc4) that contains the native ARM libraries for macOS. GAMA is run from Eclipse, in a configuration that works well on Intel computers or with Rosetta.

Everything is running fine (Java2D displays, SWT views, etc.) except JOGL, which crashes without warnings as soon as one tries to open a NEWT Window (used for the OpenGL displays in GAMA).

Here are the two "logs" I was able to gather.. Any ideas welcome !

The log produced by JOGL: https://gist.github.com/AlexisDrogoul/1adb8dd5a80602ae0f6b5691796c0532#file-log

The crash report produced by Apple: https://gist.github.com/AlexisDrogoul/1adb8dd5a80602ae0f6b5691796c0532#file-crash

Unable to determine GraphicsConfiguration : JOGL 2.4 on Java 17 & Windows 10

Reproduce with Jzy3D SurfaceDemoAWT

  • JOGL 2.4
  • JZY3D 2.0.1
  • Java 17, JDK 8
  • WIN 10

The below exception does not happen on JDK 11

Exception in thread "main" com.jogamp.opengl.GLException: Unable to determine GraphicsConfiguration: WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x699871b8]], idx 0], pfdID 7, ARB-Choosen true,
	requested GLCaps[rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL4bc.hw], on-scr[.]],
	chosen    GLCaps[wgl vid 7 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL4bc.hw], on-scr[.]]]
	at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:182)
	at com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424)
	at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1513)
	at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:609)
	at java.desktop/java.awt.Container.addNotify(Container.java:2804)
	at java.desktop/java.awt.Window.addNotify(Window.java:791)
	at java.desktop/java.awt.Frame.addNotify(Frame.java:495)
	at java.desktop/java.awt.Window.pack(Window.java:829)
	at org.jzy3d.bridge.awt.FrameAWT.initialize(FrameAWT.java:41)
	at org.jzy3d.bridge.awt.FrameAWT.<init>(FrameAWT.java:22)
	at org.jzy3d.chart.factories.AWTPainterFactory.newFrame(AWTPainterFactory.java:102)
	at org.jzy3d.chart.Chart.open(Chart.java:375)
	at org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:40)
	at org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:32)
	at org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:27)
	at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:23)
	at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:12)
	at org.jzy3d.demos.surface.SurfaceDemoAWT.main(SurfaceDemoAWT.java:30)

See also

Incorrect GL Version - Win 10 + Intel HD Graphics + JDK 8

https://forum.jogamp.org/JOGL-project-does-not-work-in-a-different-computer-td4041404.html
https://jogamp.org/bugzilla/show_bug.cgi?id=1278

I tried to get the version in code, by calling :
System.out.println("OpenGL version : " + gl.glGetString(GL2.GL_VERSION));
And I got :
OpenGL version : 1.1.0

This kind of surprises me, since it seems that the maximum valid version of OpenGL is 3.1 in my computer... And also this computer isn't that old

  • OS : Windows 10, 32 bits
  • GPU : Intel(R) HD Graphics 3000 with drivers up to date (I verified them so they should be)
  • Java : jre1.8.0_261

As stated on the original bugzilla ticket, the bug is due to intel drivers.

Instead of providing no OpenGL driver for Windows 10, Intel provides a driver that fails to load for its discontinued hardware. When a signed software claims to support Windows 10 which is the case of Oracle Java and OpenJDK 1.8.0 update 60 and later, the driver loads to load and Microsoft GDI Generic driver is used instead.

I fear that Java Webstart will follow the same route than applets (deprecated in Java 1.9, removed from Java 1.10). I remind that Java Webstart is mostly unusable without paying for a "trusted" certificate or tinkering the JRE. I don't advise to use an old version of Java as it exposes to vulnerabilities. Therefore, there is no acceptable workaround (Java Webstart or downgrading to OpenJDK 1.8.0 update 55).

If we lied to the the driver somehow, it would "work" but as it's not maintained, the bugs would remain unfixed. Intel is to blame here, there is nothing that we can do.

On the long term, using Mesa or Angle under Windows in these cases might help:
https://jogamp.org/bugzilla/show_bug.cgi?id=1179

Inconsistent GL Version : exception on GL4bcImpl.getGL2() - macOS

Discussed in a JOGL forum while trying to get the highest available OpenGL profile.

Problem

gl.getGL2() throws a "Not a GL2 implementation" when gl instance is GL4bcImpl. GL4bc being backward compatible, it is supposed to be able to return a GL2 instance.

Context

  • Fail on : Mac OS 10.12 + Intel CPU + NVidia GPU + JDK 8
  • Fail on : Mac OS 11.4 + Silicon Chip + JDK 8
  • Success on : Ubuntu 20.04 + Intel CPU + Intel GPU + JDK 8

Reproduce

See below a test program to reproduce the issue which can be summarized as follow :

When using :

  • GLProfile glp = GLProfile.getMaxProgrammable(true);
  • -Djogl.disable.openglcore=true

Then :

  • GL instance is GL4bcImpl, which is what we expect.
  • drawable.getContext().isGLCompatibilityProfile(); returns false, which shouldn't be as we explicitely disabled core open GL to get a compatibility profile.
  • gl.getGL2() throws a "Not a GL2 implementation"

Investigation

gl.getGL2() relies on GLContext.isGL2()

public final boolean isGL2() { 
      return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ; 
} 
  • with ctxOptions : 0x4C45 (which is ...0101)
  • and CTX_PROFILE_COMPAT : 0x2 (which is 10)

so I presume the problem comes from this ctxOptions value. I could not locate exactly where it is set, seamingly somewhere around GLContextImpl.createContextARB

The complete GLContext for macOS BigSur + Silicon is produced by the program given at the end of this ticket

PROFILE       : GLProfile[GL4/GL4.hw]
CAPS (query)  : GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], offscr[auto-cfg]]
CAPS (found)  : GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], offscr[fbo]]
--------------------------------------------------
GL_VENDOR     : Apple
GL_RENDERER   : Apple M1
GL_VERSION    : 4.1 Metal - 71.6.4
GL_EXTENSIONS : (43)
GL INSTANCE : jogamp.opengl.gl4.GL4bcImpl

--------------------------------------------------
MacOSXCGLContext [Version 4.1 (Core profile, arb, compat[ES2, ES3], FBO, hardware) - 4.1 Metal - 71.6.4 [GL 4.1.0, vendor 71.6.4 (Metal - 71.6.4)], options 0x4c05, this 0x68bbe345, handle 0x14f8f4500, isShared false, jogamp.opengl.gl4.GL4bcImpl@26aa12dd,
	 quirks: [NoOffscreenBitmap, GL4NeedsGL3Request, NeedSharedObjectSync],
	Drawable: ResizeableImpl[Initialized true, realized true, texUnit 0, samples 0,
	Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@3fd7a715,
	Handle    0x0,
	Caps      GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], offscr[fbo]],
	fboI back 1, front 0, num 2,
	FBO front read 1, FBO[name r/w 1/1, init true, bound false, size 100x100, samples 0/4, modified false/false, depth RenderAttachment[type DEPTH, format 0x81a5, samples 0, 100x100, name 0x1, obj 0x51cdd8a], stencil null, colorbuffer attachments: 1/8, with 1 textures: [TextureAttachment[type COLOR_TEXTURE, target GL_TEXTURE_2D, level 0, format 0x8051, 100x100, border 0, dataFormat 0x1907, dataType 0x1401; min/mag 0x2600/0x2600, wrap S/T 0x812f/0x812f; name 0x1, obj 0x711f39f9], null, null, null, null, null, null, null], msaa[null, hasSink false, dirty true], state OK, obj 0xd44fc21],
	FBO back  write 2, FBO[name r/w 2/2, init true, bound true, size 100x100, samples 0/4, modified true/true, depth RenderAttachment[type DEPTH, format 0x81a5, samples 0, 100x100, name 0x2, obj 0x2d6eabae], stencil null, colorbuffer attachments: 1/8, with 1 textures: [TextureAttachment[type COLOR_TEXTURE, target GL_TEXTURE_2D, level 0, format 0x8051, 100x100, border 0, dataFormat 0x1907, dataType 0x1401; min/mag 0x2600/0x2600, wrap S/T 0x812f/0x812f; name 0x2, obj 0x23faf8f2], null, null, null, null, null, null, null], msaa[null, hasSink false, dirty true], state OK, obj 0x4e7dc304],
	Surface   WrappedSurface[ displayHandle 0x0
, surfaceHandle 0x0
, size 100x100
, UOB[ OWNS_SURFACE | OWNS_DEVICE | WINDOW_INVISIBLE | SURFACELESS ]
, MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x64729b1e]], idx 0],
	chosen    GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], offscr[fbo]],
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], offscr[auto-cfg]]]
, surfaceLock <10bbd20a, 48503868>[count 1, qsz 0, owner <main>]
, GenericUpstreamSurfacelessHook[pixel 100x100]
, upstreamSurface false ]], mode NSOPENGL] 

Is compat profile : false
--------------------------------------------------
GL2    : true
GL2GL3 : true
GL3    : true
GL3bc  : false
GL4    : true
GL4ES3 : true
GL4bc  : false

The complete program to reproduce the issue

import org.junit.Test;
import org.jzy3d.chart.factories.NativePainterFactory;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLDrawableFactory;
import com.jogamp.opengl.GLProfile;

/**
 * This shows how to switch OpenGL version with JOGL.
 * 
 * It requires to invoke the JVM with -Djogl.disable.openglcore=true to work.
 * 
 * @see https://forum.jogamp.org/Selecting-the-highest-possible-GL-profile-at-runtime-td4041302.html
 */
public class Test_OpenGLVersion {
  @Test
  public void openGLversion() throws Exception {
    System.out.println("=============================================================");
    System.out.println("");
    System.out.println("");
    System.out.println("                    OPENGL VERSION INFO                      ");
    System.out.println("");
    System.out.println("");
    System.out.println("=============================================================");
    
    
    // ------------------------------------------------------
    // Profile & capabilities
    
    //GLProfile glp = NativePainterFactory.detectGLProfile(); // use Jzy3D profile selection

    //GLProfile glp = GLProfile.get(GLProfile.GL4);
    GLProfile glp = GLProfile.getMaxProgrammable(true);
    
    GLCapabilities caps = new GLCapabilities(glp);
    caps.setOnscreen(false);

    // ------------------------------------------------------
    // Drawable to get a GL context

    GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
    GLAutoDrawable drawable =
        factory.createOffscreenAutoDrawable(factory.getDefaultDevice(), caps, null, 100, 100);
    drawable.display();
    drawable.getContext().makeCurrent();

    GL gl = drawable.getContext().getGL();


    // ------------------------------------------------------
    // Report
    
    System.out.println("PROFILE       : " + glp);
    System.out.println("CAPS (query)  : " + caps);
    System.out.println("CAPS (found)  : " + drawable.getChosenGLCapabilities());
    
    System.out.println("--------------------------------------------------");
    System.out.println(getDebugInfo(gl));
    
    System.out.println("--------------------------------------------------");
    System.out.println(drawable.getContext());
    System.out.println();
    System.out.println("Is compat profile : " + drawable.getContext().isGLCompatibilityProfile());
    
    
    
    System.out.println("--------------------------------------------------");
    System.out.println("GL2    : " + GLProfile.isAvailable(GLProfile.GL2));
    System.out.println("GL2GL3 : " + GLProfile.isAvailable(GLProfile.GL2GL3));
    System.out.println("GL3    : " + GLProfile.isAvailable(GLProfile.GL3));
    System.out.println("GL3bc  : " + GLProfile.isAvailable(GLProfile.GL3bc));
    System.out.println("GL4    : " + GLProfile.isAvailable(GLProfile.GL4));
    System.out.println("GL4ES3 : " + GLProfile.isAvailable(GLProfile.GL4ES3));
    System.out.println("GL4bc  : " + GLProfile.isAvailable(GLProfile.GL4bc));
    

    // ------------------------------------------------------
    // Try invoking something

    
    gl.getGL2().glClear(0);
    
    gl.getGL4bc().glClear(0);
    

    // ------------------------------------------------------
    // We are done, release context for further work
    
    drawable.getContext().release();
  }

  public static String getDebugInfo(GL gl) {
    StringBuffer sb = new StringBuffer();
    sb.append("GL_VENDOR     : " + gl.glGetString(GL.GL_VENDOR) + "\n");
    sb.append("GL_RENDERER   : " + gl.glGetString(GL.GL_RENDERER) + "\n");
    sb.append("GL_VERSION    : " + gl.glGetString(GL.GL_VERSION) + "\n");
    
    String ext = gl.glGetString(GL.GL_EXTENSIONS);

    if(ext!=null) {
      String[] exts = ext.split(" ");
      sb.append("GL_EXTENSIONS : (" + exts.length + ")\n");
      /*for(String e: exts) {
        sb.append("\t" + e + "\n");
      }*/
    }
    else {
      sb.append("GL_EXTENSIONS : null\n");      
    }
    
    sb.append("GL INSTANCE : " + gl.getClass().getName() + "\n");
    
    return sb.toString();
  }
  
}

TextRenderer cache invalidation

TextRenderer cache may lead to JVM crashes when the GL context is re-initialized.

That would be great to have a cache invalidation method as discussed here.

Incorrect context on GLCanvas

https://forum.jogamp.org/Incorrect-context-on-GLCanvas-drawable-td4041391.html

Windows 10

From JOGL forum

I am using JOGL (2.4.0-rc-20210111) together with VTK 9.0.1.

In particular, I am using the GLCanvas component embedded into VTK's vtkJoglCanvasComponent.

My application works quite fine (both on Windows and on macOS - with Java 8 JRE).

However, I am facing a strange sporadic crash when I invoke a function in my application which removes the GLCanvas-based GUI panel from its container, and then adds it to a newly-created JFrame (it's a kind of "full screen mode" function of my application). This crash seems to happen only on Windows, while I've been unable to reproduce it on macOS so far.

In VTK's vtkJoglCanvasComponent class, there is a GLEventListener, whose init() callback gets called both upon initial display of the GLCanvas-based GUI panel, and then again when the GLCanvas-based GUI panel is added to the newly-created JFrame. Between the two init() calls, there is a dispose() call which is invoked when the GLCanvas-based GUI panel is removed form its original container.

Upon first invocation of the init() callback, if I call 'drawable.getContext()', I obtain an OpenGL 4.6 context, and everything works like a charm.

On the other side, upon the second invocation of the init() callback (after addition of the GLCanvas to the new JFrame), SOMETIMES calling 'drawable.getContext()', I obtain an OpenGL 1.1 context. When this happens, then VTK crashes, because VTK 9 requires at least OpenGL 3.2 in order to work properly.

I know that my description of the problem is quite limited, but can you guess why I SOMETIMES get an OpenGL 1.1 context upon init() with my GLCanvas-based panel?

This happens on many different Windows PCs with many different display adapters / drivers, when I invoke this "full screen mode" feature in my application (which works as described above: remove GLCanvas from its container --> create a new JFrame --> add the GLCanvas to the new JFrame).

It may be something in VTK, but I was just wondering if you could guess where the problem might be, and maybe point us in the correct direction.

Also, let me mention that for some reason this issue seems to appear more frequently with Jetbrain's Java 8 JRE, even though I have had a few occurrences of the issue even with Adopt OpenJDK Java 8 JRE.

Answer

I got confirmation from a collaborator having windows+Nvidia adapters that the erroneous GL version on windows with noddraw=true is fixed by adding opengl=true.

Answer

I confirm that an OpenGL 4.6 context is returned both in the case the noddraw system property is NOT passed, and in the case opengl=true is passed. This happens because, for some reason, in both cases just a single GraphicsConfiguration is returned for each GraphicsDevice.

On the other side, with noddraw=true, 6 GraphicsConfiguration are returned for each GraphicsDevice, and this seems to be the actual source of problems for the GLContext of my GLCanvas. BTW, these 6 GraphicsConfiguration are "similar" but not identical, as they only differ for their "pixel format" attribute.

Unfortunately, both workarounds (1. avoiding passing noddraw=true, 2. passing opengl=true) are NOT viable solutions for me.

In fact:

  1. If I don't pass noddraw=true, I have rendering issues both with JOGL and within the rest of my application.

  2. If I pass opengl=true, with many graphics adapters' device drivers I have Swing rendering artifacts and issues within my application. E.g., incorrect painting of toolbar buttons, etc.

So, I need to return to my initial question: why in the case 6 GraphicsConfigurations are returned, and getConfigurations() is called, then GLCanvas is initialized with an Open GL 1.1 context (at least with all NVIDIA adapters)? Is this something which can be corrected in JOGL?

Unable to determine graphics configuration on Windows / ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1

With JOGL 2.3.2, JOGL 2.4

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1
        at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:171)
        at com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424)
        at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1513)
        at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:609)
        at java.desktop/java.awt.Container.addImpl(Container.java:1150)
        at java.desktop/java.awt.Container.add(Container.java:1001)

Discussed
on JOGL forum
on JOGL bugtracker
on Jzy3D forum

JOGL 2.4 on Mac M1 has unit test failures

On Windows and MacOS, they all finish with an "Everything OK" message but running JOGL unit tests on Mac OS ARM leads to lot of JVM crashes (the list below is exported from console output, but there might be other failing test, I think I dismiss the crash popup more than 39 times :D). Test output archive differ a lot between these two platform, so I think lot of test reports are missing for Mac.

[junit] Test com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove02GLWindowNewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch11NewtAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch13Newt2AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit01AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit02AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTCompareNewtAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.TestMultipleNewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol03NewtAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventOrderAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestParentingFocus01SwingAWTRobot FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.event.TestParentingFocus03KeyTraversalAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cSwingAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting01dAWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT FAILED (crashed) 
[junit] Test com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentParentingAWT FAILED (crashed) 



[junit] Testcase: test03OffscreenPBuffer(com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove01GLCanvasSwingAWT): Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove02GLWindowNewtCanvasAWT:test02OffscreenFBO: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT:testGL2OffScreenFBODblBufMSAA: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT:test01_GLDefault: Caused an ERROR 
[junit] Testcase: testDeadlock(com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT): Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523:test10UseNEWTNotShared: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch11NewtAWT:test21GLWindowGL2ES2: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch13Newt2AWT:test11GLWindow2GLCanvasOnScrnGL2ES2: Caused an ERROR 
[junit] Testcase: test02PBufferOffscreenSupersampling(com.jogamp.opengl.test.junit.jogl.awt.TestBug461PBufferSupersamplingSwingAWT): Caused an ERROR 
[junit] Testcase: test01AccumStencilPBuffer(com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT): Caused a ERROR 
[junit] Testcase: test01DefaultPBuffer(com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT): Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT:test01_DefaultNorm: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit01AWT:test14GearsNewtCanvasAWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit02AWT:test05NopNewtCanvasAWTDefGrid: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT:test01_aa0: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.util.texture.TestJPEGJoglAWTCompareNewtAWT:test01YUV422hBase__ES2: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT:test01GL2ES2: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT:test01GL2ES2: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411:test01NewtCanvasAWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT:testCloseNewtAWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug:testEventSourceNotNewtBug: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT:testListenerStringPassingAndOrder: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.TestMultipleNewtCanvasAWT:test01: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol03NewtAWT:testCloseJFrameNewtCanvasAWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas:test02SingleButtonPressAndReleaseWithShift: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT:BeforeFirstTest: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT:BeforeFirstTest: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT:test01NEWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT:test01NEWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT:test01NEWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventOrderAWT:test01NEWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT:test01NEWT: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestParentingFocus01SwingAWTRobot:testFocus01ProgrFocus: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot:testFocus01ProgrFocus: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.event.TestParentingFocus03KeyTraversalAWT:testWindowParentingAWTFocusTraversal01Onscreen: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT:test01WindowParenting01CreateVisibleDestroy1: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT:test01AWTWinHopFrame2FrameFPS25Animator: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT:test01CreateVisibleDestroy1: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cSwingAWT:test01CreateVisibleDestroy1: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting01dAWT:test01GLWindowReparentRecreateNoPreserve: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT:test01NewtChildOnAWTParentLayouted: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT:test01AWTOneNewtChilds01: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT:test01WinHopFrame2FrameDirectHop: Caused an ERROR 
[junit] Testcase: com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentParentingAWT:testWindowParenting1AWTOneNewtChild01: Caused an ERROR 

java.io.IOException: Could not determine a temporary executable directory

Reported by @AstroPixelProcessor on Jogamp forum :

Running JOGL 2-4 with Temurin JDK 17 crashes on Linux Mint 20, 20.1, 20.2 and the latest 20.3 (only tested linux on amd64)
with the following stacktrace which is again shows a problem with native library loading when OpenGL is initialized in my application.:

Warning: Caught Exception while retrieving executable temp base directory:
java.io.IOException: Could not determine a temporary executable directory
        at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1336)
        at com.jogamp.common.util.cache.TempFileCache.<clinit>(TempFileCache.java:84)
        at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:96)
        at com.jogamp.common.os.Platform$1.run(Platform.java:313)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
        at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
        at com.ariesproductions.imageViewer.ImageViewerInitializer.init(ImageViewerInitializer.java:117)
        at com.ariesproductions.astropixelprocessor.AstroPixelProcessor.initialize(AstroPixelProcessor.java:7222)
        at com.ariesproductions.astropixelprocessor.AstroPixelProcessor.<init>(AstroPixelProcessor.java:1482)
        at com.ariesproductions.astropixelprocessor.AstroPixelProcessor$1.run(AstroPixelProcessor.java:1090)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: /opt/astropixelprocessor/natives/linux-amd64/libgluegen_rt.so
        at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.base/java.lang.Runtime.load0(Unknown Source)
        at java.base/java.lang.System.load(Unknown Source)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:625)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
        at com.jogamp.common.os.Platform$1.run(Platform.java:321)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
        at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
        at com.ariesproductions.imageViewer.ImageViewerInitializer.init(ImageViewerInitializer.java:117)

I noticed at the top of this thread that Ubuntu 18 had a similar problem, but that was gone in Ubuntu 20.
All seems to work fine with 2.4 on Windows 10 and macOS Big Sur and Linux Fedora. I will test Ubuntu 20 tomorrow hopefully.

Caught AppContextInfo(Bug 1004) IllegalAccessException: class com.jogamp.nativewindow.awt.AppContextInfo cannot access class sun.awt.AppContext (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @34a3d150 on thread main

Discussed here.

May workaround this with VM option up to Java 16 included : java --illegal-access=permit -jar my.jar

This won't work for Java 17. At build/test time, Julien suggests

I've just added this at line 486 in jogl/make/build-test.xml:
<jvmarg line="--add-opens=java.desktop/sun.awt=ALL-UNNAMED"/>

So running programs with these JVM args fixes the problem : --add-opens=java.desktop/sun.awt=ALL-UNNAMED

Which also works to avoid this illegal access exception at runtime on Java 17.

Hang on macOS

Initially discussed here by Manu

Problem

The Java3D feature works only half the time now, but on Apple Silicon. Sometime it worked, sometimes not, without any error message. It simple hangs 50% chance.
The bug is only with the native RETINA display, not with an external 5K Display.
A few users reported that Sweet Home 3D could hang too with JOGL v2.4.0-rc-20210111, but I didn't find where this deadlock could come from yet. It's probably bound to the modifications for macOS made last year (see this commit and this one). I was wondering if synchronizing on another existing lock (like the one returned by Component#getTreeLock) would help, but I didn't try yet (and my suggestion might be just stupid or nonsense).

Solution

Now that the hanging issue can be reproduced, it's much easier to try to find where it occurs in Sweet Home 3D and other JOGL programs.
First, note that this issue happens also when the free version of Rectangle application is running.

After a few tests, I found it happened when a Canvas3D instance is removed from the hierarchy of its container. With this in mind, I let the GC handle container hierarchy cleanup automatically but this delayed only the bug which eventually happened later. It looked like that a patch in Sweet Home 3D wouldn't be enough, but that some changes were required in JOGL itself.

Then after a few refinements in the part of jogamp.opengl.macosx.cgl.MacOSXCGLContext class which handles GL layer detachment and destruction, I found that calling OSXUtil.RunOnMainThread in NSOpenGLImpl#release without waiting its completion (first parameter set to false instead of true) would fix the issue. Eureka!

But when testing under older macOS 10.9 and 10.13, I experienced a similar hanging bug when setting the first parameter of OSXUtil.RunOnMainThread to false even when BetterSnapTool or Rectangle don't run! As the recent changes in the MacOSXCGLContext class were mainly programmed for macOS 10.15 (see the bug #1398), I propose for the moment to keep wait parameter to true only for macOS versions < 10.15 (note that I also tried to simply ignore OSXUtil.RunOnMainThread for old macOS versions, because the call to CGL.setContextView(ctx, 0) that it makes didn't exist before the fix of the bug #1398 but this didn't work).
This won't solve the hanging issue under older macOS versions, but at least, we can ask users to quit BetterSnapTool, Rectangle and the like under these macOS versions (or upgrade their system if they can), until we find a better solution.

Therefore, the current proposed change is to replace the statement:

OSXUtil.RunOnMainThread(true /* wait */, true /* kickNSApp */, new Runnable() {
    @Override
    public void run() {
        CGL.setContextView(ctx, 0);
    } } );

by (for your information, 10.16 version number is returned by Java 8):

boolean wait = System.getProperty("os.version").startsWith("10.") 
    && !System.getProperty("os.version").startsWith("10.15") 
    && !System.getProperty("os.version").startsWith("10.16");
OSXUtil.RunOnMainThread(wait /* wait */, true /* kickNSApp */, new Runnable() {
    @Override
    public void run() {
        CGL.setContextView(ctx, 0);
    } } );

You can test this solution with the modifications made to jogl-all.jar file available in the ZIP file jogl-all-2.4.0-rc-20221117.zip and also in SweetHome3D 7.0.2c where you can now import furniture without the hanging issue.
I tested it under macOS 10.9, 10.13.6, 12.6.1 Intel, 13.0 ARM and will test it under other macOS versions in the coming days.

Next

I ran more tests this morning, and I confirm that setting the first parameter of OSXUtil.RunOnMainThread to false worked also in Sweet Home 3D for macOS 10.15, macOS 13 Intel and even for macOS 10.14, which is very good news because it's the last macOS version which supported 32 bit applications that some people may be obliged to keep.
Therefore, this solution works for macOS versions from 10.14 to 13, but the test I proposed to add in NSOpenGLImpl#release must cite 10.14 too.
The proposed change is finally to replace the following statement in jogamp.opengl.macosx.cgl.MacOSXCGLContext class:

OSXUtil.RunOnMainThread(true /* wait */, true /* kickNSApp */, new Runnable() {
    @Override
    public void run() {
        CGL.setContextView(ctx, 0);
    } } );

by:

String osVersion = System.getProperty("os.version");
boolean wait = osVersion.startsWith("10.") 
    && !osVersion.startsWith("10.14") 
    && !osVersion.startsWith("10.15") 
    && !osVersion.startsWith("10.16");
OSXUtil.RunOnMainThread(wait /* wait */, true /* kickNSApp */, new Runnable() {
    @Override
    public void run() {
        CGL.setContextView(ctx, 0);
    } } );

This solution is programmed in the jogl-all.jar file available in the ZIP file jogl-all-2.4.0-rc-20221118.zip and also in SweetHome3D 7.0.2d where you can now import furniture without the hanging issue. I also changed the Implementation-Version value to 2.4.0-rc-20221118 in the MANIFEST.MF file of jogl-all.jar to avoid any confusion.

WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3

As suggested by this discussion, may use the JVM flag --add-exports=java.desktop/sun.awt=ALL-UNNAMED to disable this message.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/Users/martin/.m2/repository/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

See also jzy3d/jzy3d-api#142

UnsatisfiedLinkError: Can't load library: .../libgluegen_rt.dylib

If you experienced UnsatisfiedLinkError on other JOGL library than Gluegen see : #29

Gluegen native library loading error may happen for several reasons.

Hardware not supported

You are running JOGL on a hardware that is not supported. Is this is macOS M1, use this release instead.

Inappropriate permissions defined

There are wrongly defined permission schemes preventing the libraries to be loaded.
Using -Djogamp.debug.IOUtil VM argument allows showing such issue in console :
IOUtil.testDirExec: </tmp/jogamp_exe_tst6252795205786161366.sh>: Caught IOException: Cannot run program "/tmp/jogamp_exe_tst6252795205786161366.sh": error=13, Permission denied

A developer reported

The DEB packager that I used did NOT set the correct permissions on the jre/lib/jspanwhelper. After installation the permissions were 644 (RW,R,R). A chmod 755 /jre/lib/jspanwhelper fixed the JOGL native lib loading issue completely.

How to debug further

If you did not find a solution above, try enabling more logs by using the JVM arguments -Djogamp.debug.JarUtil -Djogamp.debug.JNILibLoader -Djogamp.debug.IOUtil. They will print lot of information on the loading process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.