I have a question regarding use of the glcontext. Basically, I have a scene class which has references to the GLRenderer (a class that implements GLEventListener) and an inner classe - FogTestKeyListener which extends CustomKeyListener.
All rendering works fine, but when i click a key, I need a state change to occur within the openGL context - for example - gl.glDisable(GL.GL_LIGHTING).
The way that I construct these input classes is to pass a handle of the scene plus the glContext from the renderer (obtained by previously calling canvas.getGL().).
Find below the code for one of my inner classes:
class FogTestKeyListener extends CustomKeyListener {
FogTestScene scene;
GL gl;
public FogTestKeyListener(GLScene scene, GL gl) {
this.scene = (FogTestScene)scene;
this.gl = gl;
}
public void keyReleased(KeyEvent evt) {
gl.glDisable(GL.GL_LIGHTING);
System.out.println("GL error: " + gl.glGetError());
System.out.println("Keyboard input '" + evt.getKeyChar() + "' from " + this.getClass().getName());
}
}
An error ‘1282’ is returned when the key is released and nothing happens with regard to the lighting - it stays enabled.
Am i doing something which isn’t possible within JOGL?