JOGL-Applet freezes system due reload

Hello, I’ve written a small applet using jogl. When you open your browser (I use firefox but others have the same problem) the applet loads and works really fine and every event (e.g. MouseMotion-Events) will be handled without any problems. Now if you press the reload-button, the applet will be reloaded once again and renders also without any problems. But now if you enter the GLCanvas-window in the browser with your mouse the whole system freezes and cpu-usage is 100%. I guess there’s a problem with the event-handling, because if you don’t register any event-handler, the problem won’t arise.
Had anyone the same problem, or knows anyone a workaround. It would be very helpful.

My Applet-Code for testing is this:

import java.awt.;
import java.awt.event.
;
import java.applet.;
import java.io.
;
import java.net.*;

import net.java.games.jogl.*;

public class joglapplet extends Applet
implements MouseMotionListener {

  static GLCapabilities cap=new GLCapabilities(); 
  
  GLCanvas canvas=null;
  
  String      model3D;
  
  OpenGLView oglview;
  
  int xold, yold;
  
  
  public joglapplet() {
        
        super();            
                                
        System.out.println("Konstruktor");
  }

  public void init ()
  {      
        model3D = getParameter("Model3D");
        
        if (model3D != null) {
              
              canvas = GLDrawableFactory.getFactory().createGLCanvas (cap);
              
              oglview = new OpenGLView();
              
              
                                
              canvas.addGLEventListener(oglview);
              
              canvas.addMouseMotionListener(this);
              
              canvas.setSize(getWidth(), getHeight());
              canvas.setVisible(true);
              add(canvas);
        }
  }
  
  public void start() {
        
        oglview.start();
  }
  
  public void stop() {
        
        oglview.stop();
  }

  public void mouseDragged(MouseEvent e) {            
        
        e.consume();
  
  }
  
  public void mouseMoved(MouseEvent e) {
                          
        xold = e.getX(); yold = e.getY();
        
        e.consume();
  }

}

and my OpenGLView-class:
public class OpenGLView
implements GLEventListener {

  Animator animator;
  
  double anglex = 0, angley = 145, anglez = 0, zoom = -3;
  

  

    public void init(GLDrawable drawable) {
        
        drawable.addMouseMotionListener(this);
        drawable.addKeyListener(this);
        
        GL gl = drawable.getGL();
        
        gl.glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );            
        
        animator = new Animator(drawable);
        
  }

  public void display(GLDrawable drawable) {
              
        GL      gl      = drawable.getGL      ();
        GLU      glu      = drawable.getGLU      ();

        Dimension dim = drawable.getSize();
        
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective (60.0,((double)dim.width)/dim.height,1.0,2000.0);
        
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();            
              

        gl.glTranslated(0,0,zoom);
        gl.glRotated(angley, 0,1,0);
        
        gl.glEnable(GL.GL_DEPTH_TEST);
        gl.glClearColor (0f, 0f, 0f, 0f);
        gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
                    
        
        gl.glClear( GL.GL_COLOR_BUFFER_BIT );

  }

  public void reshape(GLDrawable drawable, int x, int y, int width, int height) {
  
        if (height > 0) {
        
              GL      gl      = drawable.getGL      ();
              GLU glu = drawable.getGLU      ();
                          
              gl.glViewport ( 0, 0, width, height );
              gl.glMatrixMode ( GL.GL_PROJECTION );
              gl.glLoadIdentity();
              
              gl.glMatrixMode(GL.GL_PROJECTION);
              gl.glLoadIdentity();
              
              gl.glViewport( 0, 0, width, height );
              glu.gluPerspective (60.0,width/height,1.0,2000.0);
        }            
  }
  
  public void displayChanged(GLDrawable arg0, boolean arg1, boolean arg2) {}

}

Are you running with the latest version of JOGL (1.1 b10)? What graphics card do you have? Are you running with the latest drivers from your vendor? Are you 100% sure you aren’t trying to perform any OpenGL operations from within your mouse event listener? If everything looks like it should be working, could you boil down your applet into a small test case and file a bug with the JOGL Issue Tracker? Thanks.

[quote]…
Are you 100% sure you aren’t trying to perform any OpenGL operations from within your mouse event listener?
[/quote]
It is a problem to do so?

Do the following would be considered as doing OpenGL operation in a event handler:

Keeping the eye and look point position as variables in the class extending GLEventListener.

Reading it in display() when calling the glulookat method.

Updating their value through the events from mouse (or Keyboard)

You can only make OpenGL calls from within your GLEventListener’s callbacks in the JOGL library. Updating state that is read from your GLEventListener’s display() method is fine.

Hello,

yesterday I tried it again to solve this problem. Thanks for your tipps.
I removed all eventhandlers and tried the applet without it. The result: It freezed my system as well. But you have to press the reload-button approximately 9-11 times until the applet freezes the system without any mouse-handlers. And with registered handlers by pressing the reload-button once.

You asked me, what hardware I’m using: I have an ATI Radeon Mobile 9700 with omega-drivers running that card on a WinXP-Pro with SP2.

After reading in other posts, that ATI will make some trouble, I tried it on my old desktop-computer with an NVIDEA GeForce II. And I have to say, that it works really fine, without any problems. I wrote a special HTML-File with “refresh”-action. After two hours automatically reloading, it works well and without any problems on that machine.

Are ATI-drivers really that problematic??? What can I do instead of buying a new laptop?

Use Java Web Start to deploy your application instead of using an applet. Java Web Start is much simpler than the complicated browser integration code and seems to be much more robust.