The GLEventListener and KeyListener were implemented in the same class using the same reference to GL. I'm not posting the full code now because well, I don't have it (and it'd be wrong to allow someone the horror of seeing my learning code anyway), but this is the keyReleased method which is where I enabled and disabled things. I can gaurentee a few things, mainly that this method 'worked' in that the variable lights did get changed, that I wasn't forcing the lights to be on or off in the display method (and therefore replacing the calls here), and that this same code worked fine when moved to the display method (I added another variable updated so that I only enabled or disabled after a key had been pressed when I moved it but otherwise no change was made). What I can't be sure of, is if we are using the same version of jogl, I looked before posting earlier and there didn't seem to be any new binaries up for grabs.
boolean lights = true;
public void keyReleased(KeyEvent e){
char c = e.getKeyChar();
if (c == 'l' || c == 'L') {
lights = !lights;
if (lights) {
gl.glEnable(GL.GL_LIGHTING);
} else {
gl.glDisable(GL.GL_LIGHTING);
}
}
}
Hopefully the description of the problem is enough, I can reproduce the problem I'm sure since it was just a rotating cube with a light on it (based off nehe's lighting and texture tutorial and the texturemanager classes originally posted in this forum). I have worked around this problem by moving the enable/disable calls to the display method but I'd definitely prefer to be able to enable/disable things in other sections of code (or do more common/practical things, things I still know nothing about hehe).