Posted by
matheus23 on
Nov 25, 2012; 10:17am
URL: https://forum.jogamp.org/X11-and-libEGL-crashes-on-Archlinux-tp4027187.html
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?