Esempio n. 1
0
  // Sort of a legacy type function call, actually inside Java
  // This stuff should be in the paint call
  public synchronized void display() {

    // clear the screen and draw a yellow square
    gl.clear(GL.COLOR_BUFFER_BIT);
    // First rectangle
    gl.pushMatrix();
    gl.translate(-0.5, 0.0, 0.0);
    gl.rotate(spin, 0.0, 0.0, 1.0);
    gl.rect(-0.5, -0.5, 0.5, 0.5);
    gl.popMatrix();
    // Second rectangle
    gl.pushMatrix();
    gl.translate(0.5, 0.0, 0.0);
    gl.rotate(-spin, 0.0, 0.0, 1.0);
    gl.rect(-0.5, -0.5, 0.5, 0.5);
    gl.popMatrix();
    gl.flush(); // Make sure all commands have completed.
    gl.swap(); // Swap the render buffer with the screen buffer
  }