GLJPanel for LibGDX JOGL backend

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

Re: GLJPanel for LibGDX JOGL backend

adam_law
Yikes. I totally missed GLJPanel being a GLAutoDrawable XD

I tried as you've directed, but, doing

Animator anim = new Animator();
anim.setExclusiveContext(true);
anim.add(joglSwingPanel.getGLCanvas());

or

Animator anim = new Animator(joglSwingPanel.getGLCanvas());
anim.setExclusiveContext(true);

it throws this error.

Exception in thread "JavaFX Application Thread" com.jogamp.opengl.GLException: Trying to register GLAnimatorControl com.jogamp.opengl.util.Animator[started false, animating false, paused false, drawable 1, totals[dt 0, frames 0, fps 0.0], modeBits 1, init'ed true, animThread null, exclCtxThread true(null)], where com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1, totals[dt 0, frames 1, fps 0.0], modeBits 1, init'ed true, animThread Thread[JavaFX Application Thread-AWTAnimator#00,5,main], exclCtxThread false(null)] is already registered. Unregister first.


Edit: didn't mean to add setRunAsFastAsPossible(). it wasn't part of my attempt that generated the error. thanks.
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

gouessej
Administrator
You can stop and unregister the previous animator and then you have to register and start the new one.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

adam_law
gouessej wrote
You can stop and unregister the previous animator and then you have to register and start the new one.
Thanks for the point-out XD While I should have found stop() easily, unregistering wasn't so straightforward to get to. I used:

                JoglSwingPanel.getGLCanvas().getAnimator().stop();
                JoglSwingPanelgetGLCanvas().getAnimator().remove(JoglSwingPanel.getGLCanvas());

I also can't believe how I missed setAnimator() on GLJPanel, though it didn't work as I thought it would. I had to do Animator.add(), to register, afterwhich I needed to call start().

Unfortunately, using setExclusiveContext(true), caused the canvas to stop rendering beyond the first time the view appears. The app doesn't freeze; it's as if automatic rendering was disabled. Also, setting the animator to draw as fast as possible, didn't seem to improve anything. Basically, no gain (that I could discern), and no way to measure the benefit of using setExclusiveContext().
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

gouessej
Administrator
What happens if you cast and modify the existing animator instead of creating another one?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

adam_law
gouessej wrote
What happens if you cast and modify the existing animator instead of creating another one?
When casting and setting it to exclusive context, it shows that it's about to draw something e.g. clearing canvas to black, then nothing is rendered at all i.e. all white, which is the color of the JFX gui background.

Btw, setting things to draw as fast as possible, makes input snappier. There was a weird behavior we found last week, when we translated elements / textures. When moving right, the speed was ok, but when moving left, it was a bit sluggish. Setting the toggle made these movements behave the same way when moving, in all directions. I wouldn't have found that setting, if not for your point out, so thanks :)
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

gouessej
Administrator
You're welcome. I fear that you'll have to wait for GLJFXPanel to get a better frame rate :s
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLJPanel for LibGDX JOGL backend

adam_law
gouessej wrote
You're welcome. I fear that you'll have to wait for GLJFXPanel to get a better frame rate :s
That's not a problem :); it'll be worth the wait for our part. For now, this is the best option available.
1234