Login  Register

Re: Javafx causes jogl problem in mac

Posted by Sven Gothel on Mar 14, 2013; 12:07am
URL: https://forum.jogamp.org/Javafx-causes-jogl-problem-in-mac-tp4028417p4028626.html

On 03/12/2013 03:30 PM, runiter [via jogamp] wrote:
> Here is the exception with NewtAwt+JavaFX under Mac OS X:
>

Semantics, the getFactory(Class<?> clazz) shall return
a registered NativeWindowFactory implementation for the given class.
The given class is traversed up until it's super class until found.
If not found (i.e. not registered) the exception is thrown.

>
> java.lang.IllegalArgumentException: No registered NativeWindowFactory for
> class com.ardor3d.framework.jogl.JoglNewtAwtCanvas
>         at
> javax.media.nativewindow.NativeWindowFactory.getFactory(NativeWindowFactory.java:477)
>
>         at
> javax.media.nativewindow.NativeWindowFactory.getNativeWindow(NativeWindowFactory.java:514)
>
>         at jogamp.newt.awt.NewtFactoryAWT.getNativeWindow(NewtFactoryAWT.java:70)
>         at
> com.jogamp.newt.awt.NewtCanvasAWT.reparentWindow(NewtCanvasAWT.java:428)
>         at com.jogamp.newt.awt.NewtCanvasAWT.addNotify(NewtCanvasAWT.java:391)
The getFactory(..) source:

>     public static NativeWindowFactory getFactory(Class<?> windowClass) throws IllegalArgumentException {
>         if (nativeWindowClass.isAssignableFrom(windowClass)) {
>             return registeredFactories.get(nativeWindowClass);
>         }
>         Class<?> clazz = windowClass;
>         while (clazz != null) {
>             NativeWindowFactory factory = registeredFactories.get(clazz);
>             if (factory != null) {
>                 return factory;
>             }
>             clazz = clazz.getSuperclass();
>         }
>         throw new IllegalArgumentException("No registered NativeWindowFactory for class " + windowClass.getName());
>     }
Always:
  NativeWindowFactory.registerFactory() interface javax.media.nativewindow.NativeWindow -> jogamp.nativewindow.NativeWindowFactoryImpl@70453807

If AWT is enabled/available:
 NativeWindowFactory.registerFactory() class java.awt.Component -> jogamp.nativewindow.NativeWindowFactoryImpl@70453807

+++

Passing NewtCanvasAWT Works:
  - 'public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol, OffscreenLayerOption'
  -  NewtCanvasAWT extends java.awt.Canvas extends java.awt.Component

Passing JoglNewtAwtCanvas Does not work:
 - 'public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWindowContainer'
 -  JoglNewtAwtCanvas extends NewtCanvasAWT extends java.awt.Canvas extends java.awt.Component

I am a bit lost myself here ..,

clazz.getSuperclass() should traverse through the above list and eventually find
java.awt.Component.

This would only not be not successful, if AWT is not enabled/available.

~Sven



signature.asc (911 bytes) Download Attachment