model won't rotate

I’ve drawn a bunch of points and things on the screen but I can’t get anything to rotate according to the keys I press. Can anyone see anything wrong w/ the basic logic I have here?

Any help much appreciated.

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

    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
    gl.glColor3f(1.0f, 1.0f, 1.0f);
                                                                            
    gl.glMatrixMode(GL.GL_MODELVIEW);
    glu.gluLookAt(0.0, 0.0, 0.0, 0.0, 0.0, -100.0, 0.0, 1.0, 0.0);

    // I've tried various combinations of values with 
    // the glRotate method.
    
    gl.glRotatef(0.0f, xrot, yrot, 0.0f);

    model.draw();
        
    gl.glFlush();
}

// I’m not exactly sure about the way I’m calling the display
// method after each keypress.

public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_RIGHT:
this.yspeed += 0.01f;
yrot += 1.0;
display(this.gldrawable);

            break;
                                                                            
        case KeyEvent.VK_LEFT:
            this.yspeed -= 0.01f;
            yrot -= 1.0;
            display(this.gldrawable);
                                                                            
            break;

Hi
I think you have to set an angle in the glRotate-command i.e the first parameter. see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_21d1.asp

// Gregof

You can’t make this call:

display(this.gldrawable);

from the event dispatch thread. OpenGL is not thread safe. Replace this call with a call to repaint().

Actually, display() can be called from any thread, or at least that is the intent and the JOGL implementation should back that up as much as possible.

Repaint or display good. display(GLDrawable) bad.

Ack! You are correct sir. I hadn’t realized that was what was being done here.

You should only cause your GLEventListener’s display() method to be invoked by calling GLDrawable.display().