Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gl4java.drawable
Interface GLDrawable

All Known Implementing Classes:
  GLCanvas, GLJPanel, GLOffScreenDrawable

public interface GLDrawable

Abstracts common functionality among the OpenGL components such as GLCanvas and GLJPanel. The GLDrawable/GLEventListener interfaces allow client code to draw using OpenGL without subclassing.

Method Summary
`void` | `addComponentListener(java.awt.event.ComponentListener l)` the components listener's should be implemented also ! since JDK 1.1
`void` | `addFocusListener(java.awt.event.FocusListener l)`
`void` | `addGLEventListener(GLEventListener listener)` Add a GLEventListener to this drawable.
`void` | `addKeyListener(java.awt.event.KeyListener l)`
`void` | `addMouseListener(java.awt.event.MouseListener l)`
`void` | `addMouseMotionListener(java.awt.event.MouseMotionListener l)`
`void` | `cvsDispose()` You should call this before releasing/dispose this Window ! Also you can overwrite this class, to dispose your own elements, e.g.
`boolean` | `cvsIsInit()` This function returns, if everything is init: the GLContext, the and the users init function This value is set in the paint method!
`void` | `display()` This is the rendering-method called by e.g.: `GLCanvas.display()` or by `GLRunnable.run()`.
`GLFunc` | `getGL()` Gets the GL functions used by this drawable.
`GLContext` | `getGLContext()` Used to return the created GLContext
`GLUFunc` | `getGLU()` Gets the GLU functions used by this drawable.
`java.awt.Dimension` | `getSize()` this function returns the current size of the object
`void` | `removeComponentListener(java.awt.event.ComponentListener l)`
`void` | `removeFocusListener(java.awt.event.FocusListener l)`
`void` | `removeGLEventListener(GLEventListener listener)` Remove a GLEventListener from this drawable.
`void` | `removeMouseListener(java.awt.event.MouseListener l)`
`void` | `removeMouseMotionListener(java.awt.event.MouseMotionListener l)`
`void` | `repaint()` this function can be called to force a repaint Repaints this component.

Method Detail

### addGLEventListener

    public void addGLEventListener(GLEventListener listener)

  Add a GLEventListener to this drawable. If multiple listeners are added to a given drawable, they are notified of events in an arbitrary order.

### removeGLEventListener

    public void removeGLEventListener(GLEventListener listener)

  Remove a GLEventListener from this drawable.

### getGL

    public GLFunc getGL()

  Gets the GL functions used by this drawable. When running on JDK 1.4 this will return a `GLFunc14`.

### getGLU

    public GLUFunc getGLU()

  Gets the GLU functions used by this drawable. When running on JDK 1.4 this will return a `GLUFunc14`.

### getGLContext

    public GLContext getGLContext()

  Used to return the created GLContext

### display

    public void display()

  This is the rendering-method called by e.g.: `GLCanvas.display()` or by `GLRunnable.run()`.

  The default implementation of display() sends preDisplay, display and postDisplay events to all `GLEventListener`s associated with this GLDrawable in the above order.

      reset timer for frame duration

      for_all(gl4java.drawable.GLEventListener)
      SEND preDisplay

      if( gljMakeCurrent() )
      {
      for_all(gl4java.drawable.GLEventListener)
      SEND display
      gljSwap()
      gljFree()

      for_all(gl4java.drawable.GLEventListener)
      SEND postDisplay
      }

      stop timer for frame duration

  If you use the subclassing model (as opposed to the GLEventListener model), your subclass will redefine this to perform its OpenGL drawing. In this case you MUST encapsulate your OpenGL calls within:

      - glj.gljMakeCurrent()
      YOUR OpenGL commands here !
      - glj.gljFree()

  Returns:
    void
  See Also:
    `GLContext.gljMakeCurrent()`, `GLContext.gljFree()`, `GLContext.gljSwap()`, `GLEventListener.preDisplay(gl4java.drawable.GLDrawable)`, `GLEventListener.display(gl4java.drawable.GLDrawable)`, `GLEventListener.postDisplay(gl4java.drawable.GLDrawable)`

### repaint

    public void repaint()

  this function can be called to force a repaint Repaints this component. This method causes a call to this component's update method as soon as possible.

### cvsIsInit

    public boolean cvsIsInit()

  This function returns, if everything is init: the GLContext, the and the users init function This value is set in the paint method!
  Returns:
    boolean
  See Also:
    `GLCanvas.paint(java.awt.Graphics)`, `GLCanvas.init()`

### cvsDispose

    public void cvsDispose()

  You should call this before releasing/dispose this Window ! Also you can overwrite this class, to dispose your own elements, e.g. a Frame etc. - but be shure that you call cvsDispose implementation call this one ! This function calls gljDestroy of GLContext ! Be sure to implement finalize, which should call this one !!
  See Also:
    `GLContext.gljDestroy()`, `GLEventListener.cleanup(gl4java.drawable.GLDrawable)`

### getSize

    public java.awt.Dimension getSize()

  this function returns the current size of the object

### addComponentListener

    public void addComponentListener(java.awt.event.ComponentListener l)

  the components listener's should be implemented also ! since JDK 1.1

### removeComponentListener

    public void removeComponentListener(java.awt.event.ComponentListener l)

### addFocusListener

    public void addFocusListener(java.awt.event.FocusListener l)

### addKeyListener

    public void addKeyListener(java.awt.event.KeyListener l)

### removeFocusListener

    public void removeFocusListener(java.awt.event.FocusListener l)

### addMouseListener

    public void addMouseListener(java.awt.event.MouseListener l)

### removeMouseListener

    public void removeMouseListener(java.awt.event.MouseListener l)

### addMouseMotionListener

    public void addMouseMotionListener(java.awt.event.MouseMotionListener l)

### removeMouseMotionListener

    public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD