Javafx causes jogl problem in mac

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

Re: Javafx causes jogl problem in mac

runiter
Ok I think I found the source of the problem. In JoglAwtExample it seem to work fine from main() but not works if use threading. So here is a simple test, in JoglAwtExample.main() change the code so that frameWork.updateFrame() is run from a Thread instead of being run directly in main() method:

        new Thread() {
            @Override
            public void run() {
                while (!exit.isExit()) {
                    frameWork.updateFrame();
                    Thread.yield();
                }
                frame.dispose();
                System.exit(0);
            }
        }.start();


Don't forget to change canvas to Newt also:

    private static void addCanvas(final JFrame frame, final ExampleScene scene, final LogicalLayer logicalLayer,
            final FrameHandler frameWork) throws Exception {
        ....
        final JoglNewtAwtCanvas theCanvas = new JoglNewtAwtCanvas(settings, canvasRenderer);
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
In this case, maybe we should try to use invokeAndWait instead of GLDrawableHelper.invoke(). I don't understand the root cause of this bug.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
correction, there is no need to make a thread to see this problem. Even without the thread it fails, but it fails on the 3rd or 4rd runs forward. The 1st and 2nd run usually works for some reason. I guess when JVM is cold it is slower and give enough chance for the context to be initialized. I will try your invokeAndWait suggestion next.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
One problem I have with debugging Jogl is that I'm missing jogl source code when I reach Jogl part of the execution. Do you have a a zipped src.zip file of the latest build somewhere I can download? I don't want that to download the entire jogl project because I couldn't compile it last time I tried.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
There are ZIP archives with autobuilds as far as I know. My suggestion is crappy, I will try to understand why the drawable doesn't get realized when height = 0 in JoglNewtAwtCanvas.init().
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

Sven Gothel
Administrator
On 03/07/2013 05:30 PM, gouessej [via jogamp] wrote:
> There are ZIP archives with autobuilds as far as I know. My suggestion is
> crappy, I will try to understand why the drawable doesn't get realized when
> height = 0 in JoglNewtAwtCanvas.init().

Our GLAutoDrawable's (GLAD) GLCanvas, GLJPanel and even GLWindow, etc,
won't realize GL resources w/ zero size.

This is due to avoid GL driver difficulties ..

Hence you shall never simply assume that a GLAD is realized.

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
Sven Gothel wrote
Hence you shall never simply assume that a GLAD is realized.
Then perhaps we should check in JoglNewtAwtCanvas.draw() that GLAD is realized before rendering. Would this be a time consuming check?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
In reply to this post by Sven Gothel
Sven Gothel wrote
Our GLAutoDrawable's (GLAD) GLCanvas, GLJPanel and even GLWindow, etc,
won't realize GL resources w/ zero size.
With the above hint I managed to fix the problem by explicitly setting the size of canvas component.

I actually used to have the following code in SceneManager.java:

canvasComponent.setMinimumSize(new Dimension(500, 0));

I guess I didn't care about height at the time and only wanted to make sure the width meets the minimum. I changed it the following and it now works:

canvasComponent.setMinimumSize(new Dimension(500, 500));

Now it renders the scene without fail. Perhaps there should be an exception thrown in Canvas.init() if the canvas size is zero to hint the developers to explicitly set a size. Or event better add code in Canvas.init() to apply a small minimum size to canvas.

So, next problem is that mouse events are not capture. Does Newt use a different mechanism than regular JoglAwtCanvas for capture mouse events?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
Never mind my last question. I realized that I needed to use the follow specialized wrappers

mouseWrapper = new JoglNewtMouseWrapper(canvas, new JoglNewtMouseManager(canvas));
keyboardWrapper = new JoglNewtKeyboardWrapper(canvas);
focusWrapper = new JoglNewtFocusWrapper(canvas);

It all works now. Next step is to see if Newt will fix the compatibility problem with Javafx in Mac OS X which was my original question.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
I will simply avoid setting the boolean _inited to true if the drawable hasn't been realized. Sven's advice is very good.

I will have to fix your ClassCastException anyway.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
okay Newt experiment so far been a failure. I finally managed to get it to work on windows, but that did not fix the problem Mac OS X, in fact it made it worse. At least with JoglAwt it used to work fine if I didn't have JavaFx, but with Newt even without Javafx it doesn't work properly.

What happens is that the Canvas for some reason is rendered at a wrong location so that half of my JFrame is empty, half of it is Canvas (upper right corner). In that half the Canvas covers the Toolbar!!

Is there any way you can fix these problems quickly and get the JavaFx to work with either Newt or JoglAwt in Mac OS X? I have spent way too much time on this!
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
Runiter, please don't forget that we are volunteers, I do my best and we are not responsible for regressions caused by JavaFX itself. I plan to fix the ClassCastException in JOGL very soon but I'm not sure it will totally solve your problem. AWT support is not very good under Mac with Oracle Java, don't expect miracles.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
I understand and I appreciate it. But since there are no instructions on how to compile and run JOGL in eclipse I'm at the mercy of your volunteer time. If there was a clear tutorial on how to compile JOGL in eclipse perhaps I could've been of some help.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
That's explained here and I remind you that you can run Ant scripts within Eclipse.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

Sven Gothel
Administrator
In reply to this post by runiter
On 03/11/2013 08:40 PM, runiter [via jogamp] wrote:
> okay Newt experiment so far been a failure. I finally managed to get it to
> work on windows, but that did not fix the problem Mac OS X, in fact it made it
> worse. At least with JoglAwt it used to work fine if I didn't have JavaFx, but
> with Newt even without Javafx it doesn't work properly.
>
> What happens is that the Canvas for some reason is rendered at a wrong
> location so that half of my JFrame is empty, half of it is Canvas (upper right
> corner). In that half the Canvas covers the Toolbar!!

This is a known problem w/ OSX and CALayer, including NewtCanvasAWT
and it will be fixed soon. A partial fix of this problem is already
committed:
  git:
    http://jogamp.org/git/?p=jogl.git;a=commit;h=af384debfdf354d98e3d0d0c6e0c5cf5a967904e
  aggregated build:
    http://jogamp.org/deployment/archive/master/gluegen_645-joal_407-jogl_928-jocl_754/archive/

However, I will walk through all OSX unit test manually to check for
any misplaced CALayer, yes - this is a tedious situation.

So within 1-2 weeks, this will be solved for our unit tests using:
  - AWT, Newt, NewtCanvasAWT

However, I have not worked w/ JavaFX itself. Just thought I should mention
above OSX situation, which seems to be related.

~Sven


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

Sven Gothel
Administrator
In reply to this post by runiter
On 03/11/2013 11:59 PM, Sven Gothel wrote:
>
> This is a known problem w/ OSX and CALayer, including NewtCanvasAWT
> and it will be fixed soon. A partial fix of this problem is already
> committed:
>   git:
>     http://jogamp.org/git/?p=jogl.git;a=commit;h=af384debfdf354d98e3d0d0c6e0c5cf5a967904e

actually this one:
      http://jogamp.org/git/?p=jogl.git;a=commit;h=cbd8e33f1e19cf0c061c371af6930aba7c36b84f

>   aggregated build:
>     http://jogamp.org/deployment/archive/master/gluegen_645-joal_407-jogl_928-jocl_754/archive/
>


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
In reply to this post by Sven Gothel
Sven Gothel wrote
However, I have not worked w/ JavaFX itself. Just thought I should mention
above OSX situation, which seems to be related.
Glad to know you're already aware of it.
Note that this is not JavaFX related at all because I had JavaFX disabled when this happens.
When I run it with JavaFX enabled it doesn't work at all due to an exception about not being able to find Newt Factory or something...I will post the full exception later.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
runiter wrote
I will post the full exception later.
You already posted it, didn't you? This is in your very first post in this thread.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

runiter
gouessej wrote
runiter wrote
I will post the full exception later.
You already posted it, didn't you? This is in your very first post in this thread.
That was for JoglAwt. NewtAwt gives a different exception.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: Javafx causes jogl problem in mac

gouessej
Administrator
Ok. Please post it as soon as possible if you want some help.
Julien Gouesse | Personal blog | Website
123