Пример #1
0
  public void display(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT);

    gl.glRasterPos2i(1, 1);
    gl.glDrawPixels(
        dim.width,
        dim.height, //
        GL.GL_RGB,
        GL.GL_UNSIGNED_BYTE,
        pixels);

    gl.glFlush();
  }
Пример #2
0
  public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
    GL gl = drawable.getGL();

    gl.glViewport(0, 0, w, h);
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrtho(0, w, 0, h, -1.0, 1.0);
    gl.glMatrixMode(GL.GL_MODELVIEW);
  }
Пример #3
0
  public void init(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();

    float m[] = {
      0.0f, 1.0f, 0.0f, 0.0f, //
      0.0f, 0.0f, 1.0f, 0.0f, //
      1.0f, 0.0f, 0.0f, 0.0f, //
      0.0f, 0.0f, 0.0f, 1.0f
    };

    pixels = readImage("Data/leeds.bin", dim);
    System.out.println(pixels.toString());

    gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    gl.glMatrixMode(GL.GL_COLOR);
    gl.glLoadMatrixf(m, 0);
    gl.glMatrixMode(GL.GL_MODELVIEW);
  }