Help! Persistent Linux problem

Hi,

after more than a week of experimenting, I am still unable to solve a major problem: my code will run flawlessly on my MacOS X comp at home, but not on a Linux computer (where it will eventually be used).

I have made the .jar available via WebStart (includes source):
http://www.lewins-welt.de/kreisel/kreisel.jnlp

Thanks to TheBohemian I’ve managed starting the app using WebStart, but while this works just fine at home, trying it remotely on a Linux box yields the following results (copied from the WebStart console):


Java 2 Runtime Environment: Version 1.4.2_03 von Sun Microsystems Inc.
Protokolldatei: kreisel.log
net.java.games.jogl.GLException: Error making context current
        at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:153)
        at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:111)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
        at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:105)
        at java.awt.Component.setBounds(Component.java:1664)
        at java.awt.BorderLayout.layoutContainer(BorderLayout.java:691)
        at java.awt.Container.layout(Container.java:1020)
        at java.awt.Container.doLayout(Container.java:1010)
        at java.awt.Container.validateTree(Container.java:1092)
        at java.awt.Container.validateTree(Container.java:1099)
        at java.awt.Container.validateTree(Container.java:1099)
        at java.awt.Container.validateTree(Container.java:1099)
        at java.awt.Container.validate(Container.java:1067)
        at java.awt.Window.dispatchEventImpl(Window.java:1604)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
net.java.games.jogl.GLException: Error making context current
        at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:153)
        at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:111)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
        at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:194)
        at net.java.games.jogl.GLCanvas.display(GLCanvas.java:82)
        at de.tubs.ilr.fachlabor.kreisel.FPSAnimator$RenderRunnable.run(FPSAnimator.java:198)
        at java.lang.Thread.run(Thread.java:534)

The GLCanvas never gets drawn, and from reading other posts I got the idea that maybe the GLContext is not yet initialized properly when the FPSAnimator starts. Here’s an excerpt from my code:


      public JFrame frame;
      private GLCanvas glCanvas;
      InterfacePanel UIPanel = new InterfacePanel();
      
      public static GLDisplay createGLDisplay(String title) {
            return new GLDisplay(title, DEFAULT_WIDTH, DEFAULT_HEIGHT);
      }
      
      private GLDisplay(String title, int width, int height) {
            this.glCanvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
            this.glCanvas.setSize(width, height);
            this.glCanvas.setIgnoreRepaint(true);
            
            this.frame = new JFrame(title);
            this.frame.getContentPane().setLayout(new BorderLayout());
            
            this.frame.getContentPane().add(this.glCanvas, BorderLayout.CENTER);
            this.frame.getContentPane().add(this.UIPanel, BorderLayout.EAST);
            
            addKeyListener(this.UIPanel.gyro);
      }
      
      public void start() {
            try {
                  this.frame.setUndecorated(false);
                  this.frame.pack();
                  this.frame.setLocation(50, 50);
                  //gznote: workaround needed for Mac OS X JDK <= 1.4.1
                  // Frame.pack() doesn't always take into account the last added component
                  {
                        this.frame.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
                  }
                  final FPSAnimator animator = new FPSAnimator(this.glCanvas, DEFAULT_FPS);

                  this.frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e) {
                              animator.stop();
                              stop();
                        }
                  });
                  this.frame.setVisible(true);
                  
                  animator.start();
            } catch (Exception e) {
                  ExceptionHandler.handleException(e);
                  stop();
            }
      }

The start() method gets called from within the app’s main() method shortly after the GLDisplay is created.

BTW, I can run the Gears WebStart demo just fine remotely on the same Linux box, so I must assume that the issue is indeed hidden somewhere within my code.

What am I doing wrong here? My deadline is now less than a month away, so any help will be greatly appreciated…!

Alexander

I ran your kreisel.jnlp on my linux box without a problem. It locked up when I clicked random buttons, but the axies did show up and I could spin them.

Gentoo Linux 2.6.5 kernel

Michael

Is this the thing thats related to 24bit vs 32bit graphics modes on linux?

Kev

Could you try Mojang’s ScoreCapabilitiesChooser and let us know whether that changes or fixes the behavior?

https://jogl.dev.java.net/issues/show_bug.cgi?id=81

Also, what are your system details (OS version, graphics card, driver version, etc.)?

Thanks a lot for your input. Michael: it is encouraging to hear that it works at least on some configurations…

I have implemented the ScoreCapabilitiesChooser, and that has at least changed the behaviour… I now get an exception within the native library!

When I copied the ScoreCapabilitiesChooser into Eclipse, the IDE complained that public int chooseCapabilities(GLCapabilities min, GLCapabilities[] caps) was not implemented. So I simply called the chooseCapabilities that was present:


      public int chooseCapabilities(GLCapabilities min, GLCapabilities[] caps) {
            return chooseCapabilities(min, caps, 0);
      }

Also, the following two lines don’t work for me.


            int numSamples = caps.getNumSamples();
            boolean sampleBuffers = caps.getSampleBuffers();

Commented them out to compile. Do I need to import something to use these two? Even googling for them brought up only Mojang’s chooser code.

Now, when I try out my app at home, everything works (as before). Trying it out on the Linux box where it is supposed to run on, I now get an exception within the native code:


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xEF1
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
        at net.java.games.jogl.impl.GLUImpl.dispatch_gluPerspective(Native Method)
        at net.java.games.jogl.impl.GLUImpl.gluPerspective(GLUImpl.java:935)
        at de.tubs.ilr.fachlabor.kreisel.Renderer.reshape(Renderer.java:90)
        at net.java.games.jogl.impl.GLDrawableHelper.reshape(GLDrawableHelper.java:81)
        at net.java.games.jogl.GLCanvas$1.run(GLCanvas.java:100)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:236)
        - locked <0x44ea5678> (a net.java.games.jogl.impl.x11.X11OnscreenGLContext)
        at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
        at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
        at de.tubs.ilr.fachlabor.kreisel.FPSAnimator$RenderRunnable.run(FPSAnimator.java:198)
        at java.lang.Thread.run(Thread.java:534)

This occurs regardless of joglv version, I have tried both 1.0 and 1.1b03. OS used is Suse Linux 9.1, and glxinfo output is as follows:

direct rendering: No
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_import_context
client glx vendor string: SGI
client glx version string: 1.2
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory, 
    GLX_MESA_swap_control, GLX_MESA_swap_frame_usage, GLX_OML_swap_method, 
    GLX_OML_sync_control, GLX_SGI_make_current_read, GLX_SGI_swap_control, 
    GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig, 
    GLX_SGIX_visual_select_group
GLX extensions:
    GLX_ARB_get_proc_address, GLX_EXT_import_context, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Rage 128 OpenGL Engine
OpenGL version string: 1.1 ATI-1.3.8
OpenGL extensions:
    GL_ARB_multitexture, GL_ARB_texture_env_add, GL_ARB_texture_env_combine, 
    GL_ARB_transpose_matrix, GL_EXT_abgr, GL_EXT_texture_env_add, 
    GL_EXT_texture_lod_bias
glu version: 1.3
glu extensions:
    GLU_EXT_nurbs_tessellator, GLU_EXT_object_space_tess

   visual  x  bf lv rg d st colorbuffer ax dp st accumbuffer  ms  cav
 id dep cl sp sz l  ci b ro  r  g  b  a bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------
0x22 24 tc  1 24  0 r  .  .  8  8  8  0  0  0  0  0  0  0  0  0 0 None
0x23 24 tc  1 24  0 r  .  .  8  8  8  0  0  0  0 16 16 16 16  0 0 None
0x24 24 tc  1 24  0 r  .  .  8  8  8  0  0  0  8  0  0  0  0  0 0 None
0x25 24 tc  1 24  0 r  .  .  8  8  8  0  0  0  8 16 16 16 16  0 0 None
0x26 24 tc  1 24  0 r  y  .  8  8  8  0  0  0  0  0  0  0  0  0 0 None
0x27 24 tc  1 24  0 r  y  .  8  8  8  0  0  0  0 16 16 16 16  0 0 None
0x28 24 tc  1 24  0 r  y  .  8  8  8  0  0  0  8  0  0  0  0  0 0 None
0x29 24 tc  1 24  0 r  y  .  8  8  8  0  0  0  8 16 16 16 16  0 0 None
0x2a 24 tc  1 24  0 r  .  .  8  8  8  0  2  0  0  0  0  0  0  0 0 None
0x2b 24 tc  1 24  0 r  .  .  8  8  8  0  2  0  0 16 16 16 16  0 0 None
0x2c 24 tc  1 24  0 r  .  .  8  8  8  0  2  0  8  0  0  0  0  0 0 None
0x2d 24 tc  1 24  0 r  .  .  8  8  8  0  2  0  8 16 16 16 16  0 0 None
0x2e 24 tc  1 24  0 r  y  .  8  8  8  0  2  0  0  0  0  0  0  0 0 None
0x2f 24 tc  1 24  0 r  y  .  8  8  8  0  2  0  0 16 16 16 16  0 0 None
0x30 24 tc  1 24  0 r  y  .  8  8  8  0  2  0  8  0  0  0  0  0 0 None
0x31 24 tc  1 24  0 r  y  .  8  8  8  0  2  0  8 16 16 16 16  0 0 None
0x32 24 tc  1 24  0 r  .  .  8  8  8  0  0 24  0  0  0  0  0  0 0 None
0x33 24 tc  1 24  0 r  .  .  8  8  8  0  0 24  0 16 16 16 16  0 0 None
0x34 24 tc  1 24  0 r  .  .  8  8  8  0  0 24  8  0  0  0  0  0 0 None
0x35 24 tc  1 24  0 r  .  .  8  8  8  0  0 24  8 16 16 16 16  0 0 None
0x36 24 tc  1 24  0 r  y  .  8  8  8  0  0 24  0  0  0  0  0  0 0 None
0x37 24 tc  1 24  0 r  y  .  8  8  8  0  0 24  0 16 16 16 16  0 0 None
0x38 24 tc  1 24  0 r  y  .  8  8  8  0  0 24  8  0  0  0  0  0 0 None
0x39 24 tc  1 24  0 r  y  .  8  8  8  0  0 24  8 16 16 16 16  0 0 None
0x3a 24 tc  1 24  0 r  .  .  8  8  8  0  2 24  0  0  0  0  0  0 0 None
0x3b 24 tc  1 24  0 r  .  .  8  8  8  0  2 24  0 16 16 16 16  0 0 None
0x3c 24 tc  1 24  0 r  .  .  8  8  8  0  2 24  8  0  0  0  0  0 0 None
0x3d 24 tc  1 24  0 r  .  .  8  8  8  0  2 24  8 16 16 16 16  0 0 None
0x3e 24 tc  1 24  0 r  y  .  8  8  8  0  2 24  0  0  0  0  0  0 0 None
0x3f 24 tc  1 24  0 r  y  .  8  8  8  0  2 24  0 16 16 16 16  0 0 None
0x40 24 tc  1 24  0 r  y  .  8  8  8  0  2 24  8  0  0  0  0  0 0 None
0x41 24 tc  1 24  0 r  y  .  8  8  8  0  2 24  8 16 16 16 16  0 0 None

Any ideas?

Alexander

I just found out that the problem vanishes if I comment out the animator.start() call for my FPSAnimator. What does that mean? Is the GLCanvas not quite ready for action when the animator starts calling its display() method? Or what else might I be doing wrong?

Still confused,
Alexander

I very nearly solved all my problems by replacing GLU with the one from http://www.cse.unsw.edu.au/~cs3421/assignments/fpview/faq.html . Now my gyro simulation runs a few seconds before freezing…