Hello JogAmp! :)
I've found something strange lately when trying to use JOGL with NEWT. I've setup this demo code: package org.matheusdev.test; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import com.jogamp.newt.opengl.GLWindow; /** * @author matheusdev * */ public class JogAmpLoopTest implements GLEventListener { public static void main(String[] args) { GLCapabilitiesImmutable caps = new GLCapabilities(GLProfile.getDefault()); GLWindow window = GLWindow.create(caps); window.setTitle("JogAmp NEWT Window"); window.setSize(800, 600); window.setVisible(true); window.addGLEventListener(new JogAmpLoopTest(window)); } protected GLWindow window; public JogAmpLoopTest(GLWindow window) { this.window = window; // FPSAnimator animator = new FPSAnimator(window, 60); // animator.start(); } /* (non-Javadoc) * @see javax.media.opengl.GLEventListener#init(javax.media.opengl.GLAutoDrawable) */ @Override public void init(GLAutoDrawable drawable) { System.out.println("init()"); } /* (non-Javadoc) * @see javax.media.opengl.GLEventListener#dispose(javax.media.opengl.GLAutoDrawable) */ @Override public void dispose(GLAutoDrawable drawable) { System.out.println("dispose()"); } /* (non-Javadoc) * @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable) */ @Override public void display(GLAutoDrawable drawable) { System.out.println("display()"); } /* (non-Javadoc) * @see javax.media.opengl.GLEventListener#reshape(javax.media.opengl.GLAutoDrawable, int, int, int, int) */ @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { System.out.println("reshape()"); } } This crashes with this output: Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. libEGL warning: DRI2: failed to authenticate libEGL warning: DRI2: failed to open swrast (search paths /usr/lib/xorg/modules/dri) init() reshape() display() X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2) X11Util: Open X11 Display Connections: 2 X11Util: Open[0]: NamedX11Display[:0, 0x7f96180c1d80, refCount 1, unCloseable false] X11Util: Open[1]: NamedX11Display[:0, 0x7f96180e3aa0, refCount 1, unCloseable false] However, if I uncomment these lines: FPSAnimator animator = new FPSAnimator(window, 60); animator.start();Everything works almost as expected, only this output is given: Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. libEGL warning: DRI2: failed to authenticate libEGL warning: DRI2: failed to open swrast (search paths /usr/lib/xorg/modules/dri) init() reshape() display() display() [...] dispose() If I want to do the "looping" myself, would I need to create this FPSAnimator or subclass it? Is there another way than GLEventListener? |
Administrator
|
Hi
Ardor3D does not use any animator and it works like a charm. I'm going to try to reproduce your problem on my machine. Edit.: Why not trying to use Animator instead of FPSAnimator? Do you reproduce this crash in that case?
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by matheus23
Ok it is not a crash, it is the expected behaviour. You have to use an animator or to implement your own loop like me in TUER, otherwise the display just dies. You can override an existing animator or write your own loop that would call canvas.display().
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by matheus23
On 11/25/2012 11:17 AM, matheus23 [via jogamp] wrote:
> Hello JogAmp! :) > > I've found something strange lately when trying to use JOGL with NEWT. > > I've setup this demo code: > .. snip .. > > This crashes with this output: > > Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. > libEGL warning: DRI2: failed to authenticate > libEGL warning: DRI2: failed to open swrast (search paths /usr/lib/xorg/modules/dri) > init() > reshape() > display() > X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2) > X11Util: Open X11 Display Connections: 2 > X11Util: Open[0]: NamedX11Display[:0, 0x7f96180c1d80, refCount 1, unCloseable false] > X11Util: Open[1]: NamedX11Display[:0, 0x7f96180e3aa0, refCount 1, unCloseable false] The 'shutdown' message simply notifies you that you haven't closed NEWT resources at exit. Why does the JVM shutdown ? Because you main method exists and there is no non-daemon thread running, see our class Animator's API doc (Will copy this to FPSAnimator as well). * The Animator execution thread does not run as a daemon thread, * so it is able to keep an application from terminating.<br> * Call {@link #stop() } to terminate the animation and it's execution thread. > > > However, if I uncomment these lines: > > FPSAnimator animator = new FPSAnimator(window, 60); > animator.start(); > > Everything works almost as expected, Now main exits, but since the non-daemon thread still operates, the JVM will not shutdown. > only this output is given: > > Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated. something w/ your X11 setup .. not JOGL related > libEGL warning: DRI2: failed to authenticate > libEGL warning: DRI2: failed to open swrast (search paths /usr/lib/xorg/modules/dri) thats 'normal' and related to Mesa3D's ES/EGL impl. > init() > reshape() > display() > display() > [...] > dispose() > > > If I want to do the "looping" myself, would I need to create this FPSAnimator > or subclass it? > Is there another way than GLEventListener? Anyway you want it :) You can go as low level as you wish via factories etc and deal w/ GLContext creation and drawable handling yourself. However, keep in mind that our managed code path includes lot's of experience and is an efficient and compatible way of running GL rendering in a GL*Drawable. ~Sven signature.asc (909 bytes) Download Attachment |
Administrator
|
In reply to this post by matheus23
You can use your own loop with a GLEventListener.
Julien Gouesse | Personal blog | Website
|
In reply to this post by Sven Gothel
Wow. Thank you :) This helped me a lot.
I think I'll go and implement AnimatorBase now :) And yes, JogAmp looks indeed very thought-out :) |
Administrator
|
You're welcome.
You can override AnimatorBase (which is not an interface, GLAnimatorControl is an interface). It would be better if the main treatment of the main loop used in Animator could be easily overridden, for example to do this (typical in video games): tick(); update(); render();//actually it calls display()
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |