iicm.ge3d
Class OGLCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--iicm.ge3d.OGLCanvas
Direct Known Subclasses:
SampleCanvas, SceneCanvas

public class OGLCanvas
extends java.awt.Canvas

OGLCanvas - window context for GE3D. Copyright 1998 IICM, Graz University of Technology.

See Also:
Serialized Form

Field Summary
protected  int cheight
           
protected  int cwidth
           
static boolean loadedlib
           
protected  int mesa_backbuf
           
protected  boolean verbose
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
OGLCanvas(java.lang.String t)
          constructor
 
Method Summary
 boolean hasContext()
          check whether native methods are callable
 java.awt.Dimension minimumSize()
          ... and minimum size
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics goofy)
          create an OpenGL canvas on first painting. derived class must also call setContext () before issuing OpenGL commands paint of a derived class will typically look like this: (see also SampleCanvas in ge3dsample package) super.paint (gc); // create context on first draw if (!
 java.awt.Dimension preferredSize()
          my preferred size ...
protected  boolean setContext(boolean shading)
          activate the context before issuing OpenGL commands in paint
protected  void swapBuffers()
          when finished with drawing, swap buffers or flush drawings (for double buffering resp. single buffering)
 void update(java.awt.Graphics gc)
          no need to clear background on graphics update (will be done by 3D drawing)
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

loadedlib

public static boolean loadedlib

verbose

protected boolean verbose

cwidth

protected int cwidth

cheight

protected int cheight

mesa_backbuf

protected int mesa_backbuf
Constructor Detail

OGLCanvas

public OGLCanvas(java.lang.String t)
constructor
Parameters:
t - window title (needed to identify window)
Method Detail

preferredSize

public java.awt.Dimension preferredSize()
my preferred size ...
Overrides:
preferredSize in class java.awt.Component

minimumSize

public java.awt.Dimension minimumSize()
... and minimum size
Overrides:
minimumSize in class java.awt.Component

update

public void update(java.awt.Graphics gc)
no need to clear background on graphics update (will be done by 3D drawing)
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics goofy)
create an OpenGL canvas on first painting. derived class must also call setContext () before issuing OpenGL commands paint of a derived class will typically look like this: (see also SampleCanvas in ge3dsample package)
 super.paint (gc);  // create context on first draw

 if (!hasContext () || !setContext ())  // no context
   return;  // should clear background in this case

 // now ready to draw with OpenGL commands
 // on first draw you should call GE3D.initGE3D ()

 swapBuffers ();  // finish drawing
 
Overrides:
paint in class java.awt.Canvas

hasContext

public boolean hasContext()
check whether native methods are callable

setContext

protected boolean setContext(boolean shading)
activate the context before issuing OpenGL commands in paint
Parameters:
shading - flag - should be set to true unless wireframe drawings
Returns:
flag, whether context could be established

swapBuffers

protected void swapBuffers()
when finished with drawing, swap buffers or flush drawings (for double buffering resp. single buffering)

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
See Also:
Component.mouseEnter(java.awt.Event, int, int)

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)