Login  Register

Re: Jogl 2 stops working on Mac after Java7 update 55

Posted by Abhi on May 13, 2014; 1:43pm
URL: https://forum.jogamp.org/Jogl-2-stops-working-on-Mac-after-Java7-update-55-tp4032286p4032330.html

Hi,

I used the workaround at com.jogamp.nativewindow.awt.JAWTWindow.attachSurfaceLayer(JAWTWindow.java:235). Find below the code.

----------------------------------------------------------------------------------------------------------------------
  @Override
  public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException {
      if( !isOffscreenLayerSurfaceEnabled() ) {
          throw new NativeWindowException("Not an offscreen layer surface");
      }
      if(DEBUG) {
        System.err.println("JAWTWindow.attachSurfaceHandle: "+toHexString(layerHandle) + ", bounds "+bounds);
      }
      attachSurfaceLayerImpl(layerHandle);
      offscreenSurfaceLayer = layerHandle;
     
      // workaround of Java7u55 JOGL crash issue
      if(AppContext.getAppContext() == null){
            SunToolkit.createNewAppContext();
      }

      component.repaint();
  }
------------------------------------------------------------------------------------------------------------------------

As it was throwing exception at component.repaint(), I just put that workaround before it.

I tried using the latest JOGL but it didn't work in my project. So I have to make chnages in JOGL2.0.2 that is used in our project.