All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gnu.app.redbook.Hello Maven / Gradle / Ivy

Go to download

Escher is a collection of libraries for X Window System written purely in Java.

The newest version!
package gnu.app.redbook;

import gnu.x11.extension.glx.GL;


/**
 * Hello World. Modified from hello.c.
 *
 * @see 
 * screenshot
 * 
 * @see 
 * help output
 */
public class Hello extends gnu.x11.extension.glx.Application {
  public Hello (String [] args) {
    super (args, 0);

    about ("0.1", "hello world",
      "Stephen Tse ",
      "http://escher.sourceforge.net/");

    if (help_option) return;
    init_window (250, 250);

    // initialize viewing values
    gl.matrix_mode (GL.PROJECTION);
    gl.load_identity ();
    gl.ortho (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
  }


  protected void handle_expose () {
    // clear all pixels
    gl.clear (GL.COLOR_BUFFER_BIT);

    // white polygon (rectangle)
    gl.begin (GL.POLYGON);
    gl.vertex2f (-0.5f, -0.5f);
    gl.vertex2f (-0.5f, 0.5f);
    gl.vertex2f (0.5f, 0.5f);
    gl.vertex2f (0.5f, -0.5f);
    gl.end ();

    // action!
    gl.swap_buffers (window);
  }


  public static void main (String [] args) {
    new Hello (args).exec ();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy