javax.media.opengl
Interface GLAutoDrawable
- ComponentEvents, GLDrawable
- GLPbuffer
- GLCanvas, GLJPanel, GLPbufferImpl
public interface GLAutoDrawable
A higher-level abstraction than
GLDrawable
which supplies
an event based mechanism (
GLEventListener
) for performing
OpenGL rendering. A GLAutoDrawable automatically creates a primary
rendering context which is associated with the GLAutoDrawable for
the lifetime of the object. This context has the
synchronized
property enabled so that
calls to
makeCurrent
will block if
the context is current on another thread. This allows the internal
GLContext for the GLAutoDrawable to be used both by the event
based rendering mechanism as well by end users directly.
addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , addPropertyChangeListener , addPropertyChangeListener , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removePropertyChangeListener , removePropertyChangeListener |
addGLEventListener
public void addGLEventListener(GLEventListener listener)
Adds a
GLEventListener
to this drawable. If multiple
listeners are added to a given drawable, they are notified of
events in an arbitrary order.
display
public void display()
Causes OpenGL rendering to be performed for this GLAutoDrawable
by calling
display
for all
registered
GLEventListener
s. Called automatically by the
window system toolkit upon receiving a repaint() request. this
routine may be called manually for better control over the
rendering process. It is legal to call another GLAutoDrawable's
display method from within the
display
callback.
getAutoSwapBufferMode
public boolean getAutoSwapBufferMode()
getContext
public GLContext getContext()
Returns the context associated with this drawable. The returned
context will be synchronized.
getGL
public GL getGL()
Returns the
GL
pipeline object this GLAutoDrawable uses.
If this method is called outside of the
GLEventListener
's callback methods (init, display, etc.) it may
return null. Users should not rely on the identity of the
returned GL object; for example, users should not maintain a
hash table with the GL object as the key. Additionally, the GL
object should not be cached in client code, but should be
re-fetched from the GLAutoDrawable at the beginning of each call
to init, display, etc.
removeGLEventListener
public void removeGLEventListener(GLEventListener listener)
Removes a
GLEventListener
from this drawable. Note that
if this is done from within a particular drawable's
GLEventListener
handler (reshape, display, etc.) that it is not
guaranteed that all other listeners will be evaluated properly
during this update cycle.
repaint
public void repaint()
Schedules a repaint of the component at some point in the
future.
setAutoSwapBufferMode
public void setAutoSwapBufferMode(boolean onOrOff)
Enables or disables automatic buffer swapping for this drawable.
By default this property is set to true; when true, after all
GLEventListeners have been called for a display() event, the
front and back buffers are swapped, displaying the results of
the render. When disabled, the user is responsible for calling
GLAutoDrawable
manually.
setGL
public void setGL(GL gl)
Sets the
GL
pipeline object this GLAutoDrawable uses.
This should only be called from within the GLEventListener's
callback methods, and usually only from within the init()
method, in order to install a composable pipeline. See the JOGL
demos for examples.
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.