net.letskit.redbook.second
Class image

java.lang.Object
  extended by net.letskit.redbook.glskeleton
      extended by net.letskit.redbook.second.image
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.media.opengl.GLEventListener

public class image
extends glskeleton
implements javax.media.opengl.GLEventListener, java.awt.event.KeyListener, java.awt.event.MouseMotionListener

This program demonstrates drawing pixels and shows the effect of glDrawPixels(), glCopyPixels(), and glPixelZoom(). Interaction: moving the mouse while pressing the mouse button will copy the image in the lower-left corner of the window to the mouse position, using the current pixel zoom factors. There is no attempt to prevent you from drawing over the original image. If you press the 'r' key, the original image and zoom factors are reset. If you press the 'z' or 'Z' keys, you change the zoom factors.

Author:
Kiet Le (Java port)

Constructor Summary
image()
           
 
Method Summary
 void display(javax.media.opengl.GLAutoDrawable drawable)
           
 void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
           
 void init(javax.media.opengl.GLAutoDrawable drawable)
           
 void keyPressed(java.awt.event.KeyEvent key)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
static void main(java.lang.String[] args)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent mouse)
           
 void reshape(javax.media.opengl.GLAutoDrawable drawable, int x, int y, int w, int h)
           
 
Methods inherited from class net.letskit.redbook.glskeleton
animate, pause, refresh, runExit, setCanvas, setCanvas, setDefaultAnimator, setDefaultListeners
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

image

public image()
Method Detail

main

public static void main(java.lang.String[] args)

init

public void init(javax.media.opengl.GLAutoDrawable drawable)
Specified by:
init in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable drawable)
Specified by:
display in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable drawable,
                    int x,
                    int y,
                    int w,
                    int h)
Specified by:
reshape in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Specified by:
displayChanged in interface javax.media.opengl.GLEventListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent key)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent mouse)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener