Exemplo n.º 1
0
 // Simple redirector to our display function
 public void paint(Graphics g) {
   // First call the base class paint method to do a one time
   // Initialization - specific to the JoglCanvas class
   super.paint(g);
   // System.out.println("Call to paint");
   display();
 }
Exemplo n.º 2
0
  // Handle the keystrokes
  public void keyTyped(KeyEvent e) {

    switch (e.getKeyChar()) {
      case 'h':
        gl.matrixMode(GL.MODELVIEW); /* manipulate modelview matrix  */
        gl.rotate(15.0, 0.0, 1.0, 0.0);
        break;
      case 'j':
        gl.matrixMode(GL.MODELVIEW); /* manipulate modelview matrix  */
        gl.rotate(15.0, 1.0, 0.0, 0.0);
        break;
      case 'k':
        gl.matrixMode(GL.MODELVIEW); /* manipulate modelview matrix  */
        gl.rotate(-15.0, 1.0, 0.0, 0.0);
        break;
      case 'l':
        gl.matrixMode(GL.MODELVIEW); /* manipulate modelview matrix  */
        gl.rotate(-15.0, 0.0, 1.0, 0.0);
        break;
      case '+':
        gl.matrixMode(GL.PROJECTION); /* manipulate Projection matrix  */
        gl.translate(0.0, 0.0, 0.5);
        e.consume();
        break;
      case '-':
        gl.matrixMode(GL.PROJECTION); /* manipulate Projection matrix  */
        gl.translate(0.0, 0.0, -0.5);
        e.consume();
        break;
      case 's':
        if (r_thread == null) {
          r_thread = new Thread(this);
          r_thread.start();
        }
        break;
      case 'p':
        if (r_thread != null) {
          r_thread.interrupt();
          r_thread = null;
        }
        break;
      case 27: /* Esc will quit */
        System.exit(1);
        break;
      default:
        break;
    }
    e.consume();
    display();
  }
Exemplo n.º 3
0
 // Animation Loop
 public void spinDisplay() {
   spin = spin + 2.0;
   if (spin > 360.0) spin = spin - 360.0;
   display();
 }