de.beamertool.viewer.gui.opengl.gl
Class CompositeGLJPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
javax.media.opengl.GLJPanel
de.beamertool.viewer.gui.opengl.gl.CompositeGLJPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ComponentEvents, GLAutoDrawable, GLDrawable, GLEventListener
- Direct Known Subclasses:
- Slideshow3D
public class CompositeGLJPanel
- extends GLJPanel
- implements GLEventListener
A simplified version of GLJPanel that allows for easy mixing of 2D and 3D
elements in a Swing application. The intention of this class is to lower the
barrier of entry for developers who are familiar with Java2D and Swing but
less familiar with OpenGL and JOGL. This class handles much of the "dirty
work" so that the developer can concentrate more on adding content than on
(potentially confusing) OpenGL concepts.
This class has two modes:
- 2D mode, which uses an orthographic projection to allow for rendering
two-dimensional content via OpenGL. This mode allows developers to use JOGL
to render more complex two-dimensional elements in an existing Java2D scene.
For example, one could use OpenGL fragment shaders to achieve advanced visual
effects.
- 3D mode, which uses a perspective projection to allow for rendering
three-dimensional content via OpenGL. This mode allows developers to use JOGL
to render three-dimensional elements above, below, or alongside other
two-dimensional elements. For example, one could use OpenGL to render a
complex 3D scene, and then use Java2D and Swing to overlay a translucent
"heads-up" display over the 3D scene.
In both modes, it is possible to mix Java2D, Swing, and JOGL elements. To
simplify this process (and to help guide the developer), this class defines
four protected methods that can be overridden by the developer, which are
called in (approximately) the following order:
render2DBackground()
init3DResources()
render3DScene()
render2DForeground()
Most developers should only need to concern themselves with these four
methods. Only advanced users should find it necessary to call or override the
other public methods in this class.
- Author:
- Chris Campbell, Romain Guy
- See Also:
- Serialized Form
|
Constructor Summary |
CompositeGLJPanel(boolean isOpaque,
boolean hasDepth)
Creates a new instance of CompositeGLJPanel. |
| Methods inherited from class javax.media.opengl.GLJPanel |
addGLEventListener, addNotify, createContext, display, getAutoSwapBufferMode, getChosenGLCapabilities, getContext, getGL, removeGLEventListener, removeNotify, reshape, setAutoSwapBufferMode, setGL, setOpaque, setRealized, shouldPreserveColorBufferIfTranslucent, swapBuffers |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from interface javax.media.opengl.ComponentEvents |
addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener |
CompositeGLJPanel
public CompositeGLJPanel(boolean isOpaque,
boolean hasDepth)
- Creates a new instance of CompositeGLJPanel.
- Parameters:
isOpaque - if true, the OpenGL drawable (and therefore the panel) will be
completely opaque; if false, the OpenGL drawable will have an
alpha channel and therefore will allow any components behind
the panel to "show through"hasDepth - if true, the OpenGL drawable will be created with a depth
buffer and a perspective (3D) projection; if false, the OpenGL
drawable will not have a depth buffer and will instead use an
orthographic (2D) projection with a viewport originating in
the upper-left corner of the window (just like Swing/Java2D)
display
public void display(GLAutoDrawable drawable)
- Specified by:
display in interface GLEventListener
displayChanged
public void displayChanged(GLAutoDrawable drawable,
boolean modeChanged,
boolean deviceChanged)
- Specified by:
displayChanged in interface GLEventListener
init
public void init(GLAutoDrawable drawable)
- Specified by:
init in interface GLEventListener
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponent in class GLJPanel
reshape
public void reshape(GLAutoDrawable drawable,
int x,
int y,
int width,
int height)
- Specified by:
reshape in interface GLEventListener