Aviatrix3D JOGL Problem

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Aviatrix3D JOGL Problem

Arvid
aviatrix3d-logging.log

Hello,

I have a problem with OSGI, Aviatrix3D and JOGL (Java 8; JOGL 2.3.2; Windows 10; Nvidia Titan X)
First, this test class with only JOGL works:

@Component(immediate = true)
public final class JOGLExample {
   
    private GLWindow window;
   
        @Activate
    private void activate() {
       
        final GLProfile profile = GLProfile.get(GLProfile.GL2);
        final GLCapabilities caps = new GLCapabilities(profile);
   
        this.window = GLWindow.create(caps);
        this.window.setTitle("JOGL OSGi");
        this.window.setSize(640, 480);
        this.window.setVisible(true);
       
        GLContext context = this.window.getContext();
        context.makeCurrent();
       
        final GL2 gl3 = context.getGL().getGL2();
        gl3.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
        gl3.glClear(GL.GL_COLOR_BUFFER_BIT);
       
                context.release();
        this.window.display();
       
    }
   
        @Deactivate
    private void deactivate() {
       
        this.window.setVisible(false);
        this.window.destroy();
    }
}

But a test class with Aviatrix3D throws Exceptions (see logging.log attachment)!
I had a look to the Aviatrix3D classes and found in the Surface classes that init of JOGL:

SimpleAWTSurface (extends BaseAWTSurface):

GLDrawableFactory fac = GLDrawableFactory.getDesktopFactory();
AbstractGraphicsDevice screen_device = fac.getDefaultDevice();
GLProfile selected_profile = GLProfile.get(screen_device, GLProfile.GL2);

GraphicsRenderingCapabilities caps = GraphicsRenderingCapabilities();

GLCapabilities jogl_caps = CapabilitiesUtils.convertCapabilities(caps, selected_profile);
GLCapabilitiesChooser jogl_chooser = chooser != null ? new CapabilityChooserWrapper(chooser) : null;

canvas = new GLCanvas(caps, chooser, null);
canvas.setAutoSwapBufferMode(false);
canvasRenderer = new StandardRenderingProcessor(this);
canvasRenderer.setOwnerBuffer(canvasDescriptor);
canvas.addGLEventListener(this);

Later, the GLCanvas will set to a AWT-Frame.

The GraphicsRenderingCapabilities class has this values:

        /** Number of bits for the red component of the primary buffer. Default value 8 */
    public int redBits  = 8;
    /** Number of bits for the green component of the primary buffer. Default value 8 */
    public int greenBits = 8;
    /** Number of bits for the blue component of the primary buffer. Default value 8 */
    public int blueBits = 8;
    /** Number of bits for the alpha component of the primary buffer. Default value 0 */
    public int alphaBits = 0;
    /** Flag to enable double buffered rendering. Default value is true */
    public boolean doubleBuffered = true;
    /** Number of bits for the depth buffer. Default value 16 */
    public int depthBits      = 16;
    /** Number of red bits for the accumulation buffer. Default value 0 */
    public int accumRedBits   = 0;
    /** Number of green bits for the accumulation buffer. Default value 0 */
    public int accumGreenBits = 0;
    /** Number of blue bits for the accumulation buffer. Default value 0 */
    public int accumBlueBits  = 0;
    /** Number of alpha bits for the accumulation buffer. Default value 0 */
    public int accumAlphaBits = 0;
    /** Number of bits for the stencil buffer. Default value 0 */
    public int stencilBits    = 0;
    /**
     * Flag to enable the use of floating point, rather than integer buffer
     * for rendering. Only used for offscreen drawables such as MRTT and FBOs.
     * Defaults to false
     */
    public boolean useFloatingPointBuffers = false;
    /**
     * Flag to enable the use of MSAA sample buffers when rendering. Defaults
     * to false.
     */
    public boolean useSampleBuffers = false;
    /**
     * If {@link #useSampleBuffers} is true, this is the number of samples
     * to use per output pixel. Default value of 2.
     */
    public int numSamples = 2;
    /**
     * Support for transparent windows containing OpenGL content. When this is false, the values
     * of the transparentValues are used to determine which parts of the rendering should be considered
     * as transparent
     */
    public boolean backgroundOpaque = true;
    /**
     * If the red value is this value, then it is part of the transparent section of the
     * rendering when {@link #backgroundOpaque} is set to false. In order for the transparency
     * to render, all 4 values must match. Default value 0
     */
    public int transparentValueRed = 0;
    /**
     * If the green value is this value, then it is part of the transparent section of the
     * rendering when {@link #backgroundOpaque} is set to false. In order for the transparency
     * to render, all 4 values must match. Default value 0
     */
    public int transparentValueGreen = 0;
    /**
     * If the blue value is this value, then it is part of the transparent section of the
     * rendering when {@link #backgroundOpaque} is set to false. In order for the transparency
     * to render, all 4 values must match. Default value 0
     */
    public int transparentValueBlue = 0;
    /**
     * If the alpha value is this value, then it is part of the transparent section of the
     * rendering when {@link #backgroundOpaque} is set to false. In order for the transparency
     * to render, all 4 values must match. Default value 0
     */
    public int transparentValueAlpha = 0;
       
This looks like (found in Line 4155):
GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.sw]

I hope, someone can help me to unerstand whats happend.

Kind regards
Arvid
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
Ok, let's have a look at the loggings:

1) Line 7: java.lang.IllegalArgumentException: Buffer is not an ELF Header
              Not Windows, only Linux has an ELF-Header!(?)

2) Line 89: java.lang.Exception: JVMUtil.initSingleton() .. initialized main
                gluegen-rt loading ok???

3) Lines 246, 333, ... : java.lang.ClassNotFoundException: sun.java2d.opengl.OGLUtilities cannot be found by com.io7m.bundles.org.jogamp.jogl_2.3.2
              ??? (OSGI JOGL bundles)

4) Line 3982: com.jogamp.opengl.GLException: No GLDrawableFactory available for profile: GLES2
                   no problem ???

5) Line 20300, ...: several errors ???

6) Line 23343: main: GLCanvas: TK disableBackgroundErase error: java.lang.reflect.InvocationTargetException
                     ???

7) Line 23597: updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with 6 pfd ids
                      cannot load caps???

OSGI - JOGL debug vm args:
-runvm: -Djogamp.debug=all, -Dnativewindow.debug=all, -Djogl.debug=all, -Dnewt.debug=all, -Dsun.java2d.noddraw=true, -Dsun.awt.noerasebackground=true
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Xerxes Rånby
3) Lines 246, 333, ... : java.lang.ClassNotFoundException: sun.java2d.opengl.OGLUtilities cannot be found by com.io7m.bundles.org.jogamp.jogl_2.3.2 

Platform: Java Version: 1.8.0_112 (1.8.0u112), VM: Java HotSpot(TM) 64-Bit Server VM, Runtime: Java(TM) SE Runtime Environment
Platform: Java Vendor: Oracle Corporation, http://java.oracle.com/, JavaSE: true, Java6: true, AWT enabled: true
This hints that your Java 8 implementation prevents you to initialize the class OGLUtilities, a class that is part of AWT java2d and shipped with the JVM, thus it should be available, however we have recently seen oracles JVM implementation to restrict initialization of AWT classes from outside the JVM runtime classes.

It may be similar to the situation with recent JVM implementations of Java 9

You can try add the following JVM argument and check if that fixes your issue.
--permit-illegal-access
alternatively these jvm option:
--add-exports=java.base/java.lang=ALL-UNNAMED
--add-exports=java.desktop/sun.awt=ALL-UNNAMED
--add-exports=java.desktop/sun.java2d=ALL-UNNAMED



2017-12-11 13:29 GMT+01:00 Arvid [via jogamp] <[hidden email]>:
Ok, let's have a look at the loggings:

1) Line 7: java.lang.IllegalArgumentException: Buffer is not an ELF Header
              Not Windows, only Linux has an ELF-Header!(?)

2) Line 89: java.lang.Exception: JVMUtil.initSingleton() .. initialized main
                gluegen-rt loading ok???

3) Lines 246, 333, ... : java.lang.ClassNotFoundException: sun.java2d.opengl.OGLUtilities cannot be found by com.io7m.bundles.org.jogamp.jogl_2.3.2
              ??? (OSGI JOGL bundles)

4) Line 3982: com.jogamp.opengl.GLException: No GLDrawableFactory available for profile: GLES2
                   no problem ???

5) Line 20300, ...: several errors ???

6) Line 23343: main: GLCanvas: TK disableBackgroundErase error: java.lang.reflect.InvocationTargetException
                     ???

7) Line 23597: updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with 6 pfd ids
                      cannot load caps???

OSGI - JOGL debug vm args:
-runvm: -Djogamp.debug=all, -Dnativewindow.debug=all, -Djogl.debug=all, -Dnewt.debug=all, -Dsun.java2d.noddraw=true, -Dsun.awt.noerasebackground=true


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Aviatrix3D-JOGL-Problem-tp4038396p4038397.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
Rather disable the OpenGL Java2D pipeline. The workaround I suggested in the bug report has no chance to work with Java 1.8.

Is Aviatrix3D still maintained?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
In reply to this post by Arvid
It's probably a class loader problem that prevents you from loading sun.* classes:
http://forum.jogamp.org/OSGi-with-Bndtools-and-Apache-Felix-throws-exception-td4028765.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
In reply to this post by gouessej
Hello Julien,

I want to bring a monolithic Eclipse RCP project with Aviatrix3D into a new (more modern) form with OSGI (web frontend instead of RCP).
It was a steep learning curve for me to understand Aviatrix3D. But it was worth it.
Justin Couch works on it from time to time and it has the version 3.1 since last year.

When I started my project 10 years ago, there was no competition.
I did not like Suns Java 3D.
Ardor3D looks interesting, I would have to take a closer look.
But first I want to get it running again with Aviatrix3D ;-)

Kind regards,
Arvid
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
In reply to this post by gouessej
I already feared that!

I know this posting! The bad thing is that it does not show any solution. :-(

I hoped it was just a JOGL / Aviatrix3D problem.

Please have a look to my postings at the OSGI BNDTools-users for a little more background:
https://groups.google.com/forum/#!topic/bndtools-users/RAqWFrdXQdg
(bndtools native lib resolving problem)

Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
But why works the JOGLExample (see my first post above)?

What is so different with this and the Aviatrix3D init with AWT-Frame?

Maybe I can change the way how Avaitrix3D does it in it's Surface classes???
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
Mark is going to fix the bundles so that you won't have to tinker os.name and you can make a single OSGI bundle for JogAmp instead of putting apart JOGL and GlueGen. Why not using jogamp-fat.jar?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
Hello Julien,

I did fix it for myself (checkout Marks project; Change the os.name; build and install (.m2) it with maven).

What you mean with "instead of putting apart JOGL and GlueGen"? Is it not together in Marks bundles?

Please keep in mind that the simple JOGLExample works with this OSGI-JOGL-Bundles!

When I understand it right, the missing class "sun.java2d.opengl.OGLUtilities" is for rendering with Java2D.(?)
I read somewhere that you can turn it off.??? How???

Are the exceptions in the remaining logging successor error of the missing class?

Ok, you wrote in the other topic, that you use JOGL successful with eclipse (RCP) plugins.
I too!!! But, I think, OSGI specialy with bndtools need a more specific using.

I tried with jogamp-fat.jar. But I need OSGI bundles and I was not able to make it working in this context.

I'm afraid this will be a ping-pong game between OSGI, Aviatrix3D and JOGL. I really want to avoid that.
I want to use it and see no reason why that should not work in the end.

Kind regards, Arvid
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Xerxes Rånby
In reply to this post by Arvid


2017-12-11 20:55 GMT+01:00 Arvid [via jogamp] <[hidden email]>:
But why works the JOGLExample (see my first post above)?


The JOGLExample work because it is only using jogamp classes!
A Jogamp GLWindow work on all platforms we support. (no AWT or java2d is required required to initialize a GLWindow we call the operatingsystems window toolkit directly)
 
What is so different with this and the Aviatrix3D init with AWT-Frame?

When using an AWT-Frame then JOGL is instructed to paint directly on an window initialized by AWT.
In this case JOGL need to use the OGLUtilities class in order to know where to render.
Using this setup window initialization and all events are handled by AWT.

 

Maybe I can change the way how Avaitrix3D does it in it's Surface classes??? 

What you can do in Avitrix3D is letting JOGL initialize the window using a GLWindow.
Place the GLWindow into a com.jogamp.newt.awt.NewtCanvasAWT.
And then place the NewtCanvasAWT into an AWT or Swing GUI.
Using this setup window initialization and all events are handled by JogAmp.

NewtCanvasAWT, representing an AWT Canvas, allows you to hook a NEWT Window into it.

Since the NewtCanvasAWT is an AWT heavyweight Component, this gives you the ability hook NEWT into an AWT UI.

The implementation uses the AWT native JAWT API to reparent the NEWT Window natively into the AWT one
and hence is even more compatible with JOGL’s GLCanvas implementation.

Example how to initialize a GLWindow, place it into a NewtCanvasAWT and placing it all into an AWT GUI.
 
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
Hello Xerxes,

thank you very much!
A short time before I read your posting, I found this NewtCanvasAWT class in an example!

For me it does not matter what I use for a window. It should only support full screen.  

I will try it!

Kind regards
Arvid
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
In reply to this post by Arvid
Arvid wrote
Please keep in mind that the simple JOGLExample works with this OSGI-JOGL-Bundles!

When I understand it right, the missing class "sun.java2d.opengl.OGLUtilities" is for rendering with Java2D.(?)
I read somewhere that you can turn it off.??? How???
I wrote "disable the OpenGL Java2D pipeline": -Dsun.java2d.opengl=false
Keep in mind that JOGLExample uses neither AWT nor Java2D.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
In reply to this post by Arvid
Personally, I prefer disabling the automated native library loading which isn't designed to work with modules, setting the Java library path if necessary and calling initSingleton() when I activate the bundle. Of course, if a smarter solution works, it will be better for the community but if you still have to tinker Mark's bundles, other options will remain useful.

I'm sorry to contradict you but there were already several major frameworks available 10 years ago, especially JMonkeyEngine and 3DzzD (Ardor3D and JogAmp's Ardor3D Continuation appeared a lot later).

What do you mean by "web frontend"? Applets are dead and Java Webstart has become very painful to use. If you look for something "modern" to handle modules, why not using Java Platform Module System (available in Java 1.9) instead of OSGI?

Edit.: There is obviously nothing wrong with Aviatrix3D.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

Arvid
Hello Julien,

ok, it was a little more as 10 years. ;-)
I have to admit that I'm not a 3D professional. My project is a hobby project,
although I hope it will be more popular when it's done. :-)

I started with Java3D back then and found Aviatrix3D because it fits better with my project.
It is not a 3D application like a game, but a kind of modular system for 3D applications like games.

With the then eclipse RCP version, I had little contact with JOGL.
Aviatrix has covered it nicely. There were eclipse plugins for Aviatrix3D.

With webfrontend I mean a REST API based (thin) client application.
I have not started with it yet, but think of GWT or Angular2.

I have a little more experience with OSGI because I am also interested in IOT.
Here in Germany OSGI is also gladly used by companies.
With Jingsaw (Java 9) I have not worked yet.

I still have a lot of catching up to do with the actual content in my project
and want to use relatively future-ready technologies to focus on what's important to me.

I understand better now how everything fits together.
But I still have enough understanding problems :-(

But first I will try a solution with NewtCanwasAwt.
I hope Aviatrix3D will work with it  ... At least it should be unaffected!(???)

Kind regards, Arvid
Reply | Threaded
Open this post in threaded view
|

Re: Aviatrix3D JOGL Problem

gouessej
Administrator
Arvid wrote
ok, it was a little more as 10 years. ;-)
JMonkeyEngine has existed since 2003.

Arvid wrote
With webfrontend I mean a REST API based (thin) client application.
I have not started with it yet, but think of GWT or Angular2.
If you need to use OpenGL in your client application, you'll need WebGL. WebGL4J or something similar might help, there is no easy way of reusing source code based on JOGL (Java) in WebGL (Javascript). Making it work isn't a trivial task. As far as I know, LibGDX is able to support several backends, one of them relies on JOGL, another one relies on WebGL, there are at least two other backends, maybe it can be a nice source of inspiration.

As you need something future proof, don't use a JRE in the web browser. Bck2Brwsr and solutions allowing to transpile Java into WebAssembly don't need a plugin to run Java.
Julien Gouesse | Personal blog | Website