public class GLJPanel
extends javax.swing.JPanel
implements com.jogamp.opengl.awt.AWTGLAutoDrawable, com.jogamp.nativewindow.WindowClosingProtocol, com.jogamp.nativewindow.awt.AWTPrintLifecycle, com.jogamp.opengl.GLSharedContextSetter, com.jogamp.nativewindow.ScalableSurface
The GLJPanel can be made transparent by creating it with a
GLCapabilities object with alpha bits specified and calling setOpaque(boolean)
(false). Pixels with resulting OpenGL alpha values less than 1.0
will be overlaid on any underlying Swing rendering.
This component attempts to use hardware-accelerated rendering via FBO or
pbuffers and falls back on to software rendering if none of the former are
available using GLDrawableFactory.createOffscreenDrawable(..)
.
A vertical-flip is required, if the drawable
isGLOriented()
and vertical flip is not
skipped
.
In this case this component performs the required vertical
flip to bring the content from OpenGL's orientation into AWT's
orientation.
In case GLSL based
vertical-flip is not available, the CPU intensive System.arraycopy(..)
is
used line by line. See details about FBO and
GLSL vertical flipping.
For performance reasons, as well as for GL state
sideeffects, skipping vertical flip
is highly recommended!
The OpenGL path is concluded by copying the rendered pixels an BufferedImage
via glReadPixels(..)
for later Java2D composition.
Finally the Java2D compositioning takes place via via Graphics.drawImage(...)
on the prepared
BufferedImage
as described above.
Please read Java2D OpenGL Remarks.
vertical
flip is not skipped
, a fragment shader is utilized to flip the FBO texture
vertically. This hardware-accelerated step can be disabled via system
property jogl.gljpanel.noglsl
.
The FBO / GLSL code path uses one texture-unit and binds the FBO texture
to it's active texture-target, see setTextureUnit(int)
and getTextureUnit()
.
The active and dedicated texture-unit's GL.GL_TEXTURE_2D
state
is preserved via TextureState
.
The current gl-viewport is preserved.
Warning (Bug 842): Certain GL states other
than viewport and texture (see above) influencing rendering, will also
influence the GLSL vertical flip, e.g. glFrontFace
(GL.GL_CCW
). It is recommended to reset those states to
default when leaving the GLEventListener.display(GLAutoDrawable)
method! We may change this behavior in the future, i.e. preserve all
influencing states.
GLContext
see the following note in the documentation overview: context sharing as well
as GLSharedContextSetter
.javax.swing.JComponent.AccessibleJComponent
java.awt.Component.BaselineResizeBehavior
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DEFAULT_PRINT_TILE_SIZE
Constructor and Description |
---|
GLJPanel()
Creates a new GLJPanel component with a default set of OpenGL
capabilities and using the default OpenGL capabilities selection
mechanism.
|
GLJPanel(com.jogamp.opengl.GLCapabilitiesImmutable userCapsRequest)
Creates a new GLJPanel component with the requested set of OpenGL
capabilities, using the default OpenGL capabilities selection mechanism.
|
GLJPanel(com.jogamp.opengl.GLCapabilitiesImmutable userCapsRequest,
com.jogamp.opengl.GLCapabilitiesChooser chooser)
Creates a new GLJPanel component.
|
Modifier and Type | Method and Description |
---|---|
void |
addGLEventListener(com.jogamp.opengl.GLEventListener listener) |
void |
addGLEventListener(int index,
com.jogamp.opengl.GLEventListener listener) |
void |
addNotify()
Overridden to track when this component is added to a container.
|
boolean |
areAllGLEventListenerInitialized() |
boolean |
canSetSurfaceScale() |
com.jogamp.opengl.GLContext |
createContext(com.jogamp.opengl.GLContext shareWith) |
void |
destroy()
Just an alias for removeNotify
|
void |
display() |
com.jogamp.opengl.GLEventListener |
disposeGLEventListener(com.jogamp.opengl.GLEventListener listener,
boolean remove) |
void |
flushGLRunnables() |
com.jogamp.opengl.GLAnimatorControl |
getAnimator() |
boolean |
getAutoSwapBufferMode() |
com.jogamp.opengl.GLCapabilitiesImmutable |
getChosenGLCapabilities() |
com.jogamp.opengl.GLContext |
getContext() |
int |
getContextCreationFlags() |
float[] |
getCurrentSurfaceScale(float[] result) |
com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider |
getCustomPixelBufferProvider() |
com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode |
getDefaultCloseOperation() |
com.jogamp.opengl.GLDrawable |
getDelegatedDrawable() |
java.lang.Thread |
getExclusiveContextThread() |
com.jogamp.opengl.GLDrawableFactory |
getFactory() |
com.jogamp.opengl.GL |
getGL() |
com.jogamp.opengl.GLEventListener |
getGLEventListener(int index) |
int |
getGLEventListenerCount() |
boolean |
getGLEventListenerInitState(com.jogamp.opengl.GLEventListener listener) |
com.jogamp.opengl.GLProfile |
getGLProfile() |
long |
getHandle() |
float[] |
getMaximumSurfaceScale(float[] result) |
float[] |
getMinimumSurfaceScale(float[] result) |
com.jogamp.nativewindow.NativeSurface |
getNativeSurface() |
com.jogamp.opengl.GLCapabilitiesImmutable |
getRequestedGLCapabilities() |
float[] |
getRequestedSurfaceScale(float[] result) |
boolean |
getSkipGLOrientationVerticalFlip()
|
int |
getSurfaceHeight() |
int |
getSurfaceWidth() |
int |
getTextureUnit()
Returns the used texture unit, i.e.
|
com.jogamp.common.util.locks.RecursiveLock |
getUpstreamLock() |
java.lang.Object |
getUpstreamWidget() |
boolean |
initializeBackend(boolean offthread)
Attempts to initialize the backend, if not initialized yet.
|
boolean |
invoke(boolean wait,
com.jogamp.opengl.GLRunnable glRunnable) |
boolean |
invoke(boolean wait,
java.util.List<com.jogamp.opengl.GLRunnable> glRunnables) |
boolean |
isGLOriented() |
boolean |
isRealized() |
boolean |
isThreadGLCapable() |
void |
print(java.awt.Graphics graphics) |
void |
releasePrint() |
com.jogamp.opengl.GLEventListener |
removeGLEventListener(com.jogamp.opengl.GLEventListener listener) |
void |
removeNotify()
Overridden to track when this component is removed from a container.
|
void |
reshape(int x,
int y,
int width,
int height)
Overridden to cause
GLDrawableHelper.reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int) to be called on all
registered GLEventListener s. |
void |
setAnimator(com.jogamp.opengl.GLAnimatorControl animatorControl) |
void |
setAutoSwapBufferMode(boolean enable) |
com.jogamp.opengl.GLContext |
setContext(com.jogamp.opengl.GLContext newCtx,
boolean destroyPrevCtx) |
void |
setContextCreationFlags(int flags) |
com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode |
setDefaultCloseOperation(com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode op) |
java.lang.Thread |
setExclusiveContextThread(java.lang.Thread t) |
com.jogamp.opengl.GL |
setGL(com.jogamp.opengl.GL gl) |
void |
setGLEventListenerInitState(com.jogamp.opengl.GLEventListener listener,
boolean initialized) |
void |
setOpaque(boolean opaque) |
void |
setPixelBufferProvider(com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider custom) |
void |
setRealized(boolean realized) |
void |
setRequestedGLCapabilities(com.jogamp.opengl.GLCapabilitiesImmutable caps)
Set a new requested
GLCapabilitiesImmutable for this GLJPanel
allowing reconfiguration. |
void |
setSharedAutoDrawable(com.jogamp.opengl.GLAutoDrawable sharedAutoDrawable) |
void |
setSharedContext(com.jogamp.opengl.GLContext sharedContext) |
void |
setSkipGLOrientationVerticalFlip(boolean v)
Skip
isGLOriented() based vertical flip, which usually is
required by the offscreen backend, see details about vertical flip and FBO / GLSL vertical flip. |
boolean |
setSurfaceScale(float[] pixelScale) |
void |
setTextureUnit(int v)
Allows user to request a texture unit to be used, must be called before
the first initialization, i.e.
|
void |
setupPrint(double scaleMatX,
double scaleMatY,
int numSamples,
int tileWidth,
int tileHeight) |
boolean |
shouldPreserveColorBufferIfTranslucent()
For a translucent GLJPanel (one for which
setOpaque (false) has been called), indicates whether the application
should preserve the OpenGL color buffer (GL_COLOR_BUFFER_BIT) for correct
rendering of the GLJPanel and underlying widgets which may show through
portions of the GLJPanel with alpha values less than 1. |
void |
swapBuffers() |
java.lang.String |
toString() |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, 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
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, transferFocusDownCycle, validate
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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener
public GLJPanel() throws com.jogamp.opengl.GLException
See details about OpenGL context sharing.
com.jogamp.opengl.GLException
- if no default profile is available for the default
desktop device.public GLJPanel(com.jogamp.opengl.GLCapabilitiesImmutable userCapsRequest) throws com.jogamp.opengl.GLException
See details about OpenGL context sharing.
com.jogamp.opengl.GLException
- if no GLCapabilities are given and no default profile
is available for the default desktop device.public GLJPanel(com.jogamp.opengl.GLCapabilitiesImmutable userCapsRequest, com.jogamp.opengl.GLCapabilitiesChooser chooser) throws com.jogamp.opengl.GLException
See details about OpenGL context sharing.
com.jogamp.opengl.GLException
- if no GLCapabilities are given and no default profile
is available for the default desktop device.public final boolean initializeBackend(boolean offthread)
If backend is already initialized method returns true
.
If offthread
is true
, initialization will
kicked off on a short lived arbitrary thread and method returns
immediately. If platform supports such arbitrary thread
initialization method returns true
, otherwise
false
.
If offthread
is false
, initialization be
performed on the current thread and method returns after
initialization. Method returns true
if initialization was
successful, otherwise false
.
offthread
- current or background threadpublic final void setSharedContext(com.jogamp.opengl.GLContext sharedContext) throws java.lang.IllegalStateException
setSharedContext
in interface com.jogamp.opengl.GLSharedContextSetter
java.lang.IllegalStateException
public final void setSharedAutoDrawable(com.jogamp.opengl.GLAutoDrawable sharedAutoDrawable) throws java.lang.IllegalStateException
setSharedAutoDrawable
in interface com.jogamp.opengl.GLSharedContextSetter
java.lang.IllegalStateException
public com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider getCustomPixelBufferProvider()
public void setPixelBufferProvider(com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider custom) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
custom
- custom AWTGLPixelBuffer.AWTGLPixelBufferProvider
java.lang.IllegalArgumentException
- if custom
is null
java.lang.IllegalStateException
- if backend is already realized, i.e. this instanced already painted once.public final java.lang.Object getUpstreamWidget()
getUpstreamWidget
in interface com.jogamp.opengl.GLAutoDrawable
public final com.jogamp.common.util.locks.RecursiveLock getUpstreamLock()
getUpstreamLock
in interface com.jogamp.opengl.GLAutoDrawable
public final boolean isThreadGLCapable()
isThreadGLCapable
in interface com.jogamp.opengl.GLAutoDrawable
public void display()
display
in interface com.jogamp.opengl.GLAutoDrawable
public void destroy()
destroy
in interface com.jogamp.opengl.GLAutoDrawable
public final boolean setSurfaceScale(float[] pixelScale)
setSurfaceScale
in interface com.jogamp.nativewindow.ScalableSurface
public final float[] getRequestedSurfaceScale(float[] result)
getRequestedSurfaceScale
in interface com.jogamp.nativewindow.ScalableSurface
public final float[] getCurrentSurfaceScale(float[] result)
getCurrentSurfaceScale
in interface com.jogamp.nativewindow.ScalableSurface
public float[] getMinimumSurfaceScale(float[] result)
getMinimumSurfaceScale
in interface com.jogamp.nativewindow.ScalableSurface
public float[] getMaximumSurfaceScale(float[] result)
getMaximumSurfaceScale
in interface com.jogamp.nativewindow.ScalableSurface
public void addNotify()
addNotify
in class java.awt.Component
addNotify
in class javax.swing.JComponent
public void removeNotify()
removeNotify
in class
java.awt.Component
removeNotify
in class javax.swing.JComponent
public void reshape(int x, int y, int width, int height)
GLDrawableHelper.reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int)
to be called on all
registered GLEventListener
s. Subclasses which override this
method must call super.reshape() in their reshape() method in order to
function properly.
reshape
in class javax.swing.JComponent
public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight)
setupPrint
in interface com.jogamp.nativewindow.awt.AWTPrintLifecycle
public void releasePrint()
releasePrint
in interface com.jogamp.nativewindow.awt.AWTPrintLifecycle
public void print(java.awt.Graphics graphics)
print
in class javax.swing.JComponent
public void setOpaque(boolean opaque)
setOpaque
in class javax.swing.JComponent
public void addGLEventListener(com.jogamp.opengl.GLEventListener listener)
addGLEventListener
in interface com.jogamp.opengl.GLAutoDrawable
public void addGLEventListener(int index, com.jogamp.opengl.GLEventListener listener)
addGLEventListener
in interface com.jogamp.opengl.GLAutoDrawable
public int getGLEventListenerCount()
getGLEventListenerCount
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLEventListener getGLEventListener(int index) throws java.lang.IndexOutOfBoundsException
getGLEventListener
in interface com.jogamp.opengl.GLAutoDrawable
java.lang.IndexOutOfBoundsException
public boolean areAllGLEventListenerInitialized()
areAllGLEventListenerInitialized
in interface com.jogamp.opengl.GLAutoDrawable
public boolean getGLEventListenerInitState(com.jogamp.opengl.GLEventListener listener)
getGLEventListenerInitState
in interface com.jogamp.opengl.GLAutoDrawable
public void setGLEventListenerInitState(com.jogamp.opengl.GLEventListener listener, boolean initialized)
setGLEventListenerInitState
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLEventListener disposeGLEventListener(com.jogamp.opengl.GLEventListener listener, boolean remove)
disposeGLEventListener
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLEventListener removeGLEventListener(com.jogamp.opengl.GLEventListener listener)
removeGLEventListener
in interface com.jogamp.opengl.GLAutoDrawable
public void setAnimator(com.jogamp.opengl.GLAnimatorControl animatorControl)
setAnimator
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLAnimatorControl getAnimator()
getAnimator
in interface com.jogamp.opengl.GLAutoDrawable
public final java.lang.Thread setExclusiveContextThread(java.lang.Thread t) throws com.jogamp.opengl.GLException
setExclusiveContextThread
in interface com.jogamp.opengl.GLAutoDrawable
com.jogamp.opengl.GLException
public final java.lang.Thread getExclusiveContextThread()
getExclusiveContextThread
in interface com.jogamp.opengl.GLAutoDrawable
public boolean invoke(boolean wait, com.jogamp.opengl.GLRunnable glRunnable) throws java.lang.IllegalStateException
invoke
in interface com.jogamp.opengl.GLAutoDrawable
java.lang.IllegalStateException
public boolean invoke(boolean wait, java.util.List<com.jogamp.opengl.GLRunnable> glRunnables) throws java.lang.IllegalStateException
invoke
in interface com.jogamp.opengl.GLAutoDrawable
java.lang.IllegalStateException
public void flushGLRunnables()
flushGLRunnables
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLContext createContext(com.jogamp.opengl.GLContext shareWith)
createContext
in interface com.jogamp.opengl.GLAutoDrawable
createContext
in interface com.jogamp.opengl.GLDrawable
public void setRealized(boolean realized)
setRealized
in interface com.jogamp.opengl.GLDrawable
public boolean isRealized()
isRealized
in interface com.jogamp.opengl.GLDrawable
public com.jogamp.opengl.GLContext setContext(com.jogamp.opengl.GLContext newCtx, boolean destroyPrevCtx)
setContext
in interface com.jogamp.opengl.GLAutoDrawable
public final com.jogamp.opengl.GLDrawable getDelegatedDrawable()
getDelegatedDrawable
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GLContext getContext()
getContext
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GL getGL()
getGL
in interface com.jogamp.opengl.GLAutoDrawable
public com.jogamp.opengl.GL setGL(com.jogamp.opengl.GL gl)
setGL
in interface com.jogamp.opengl.GLAutoDrawable
public void setAutoSwapBufferMode(boolean enable)
setAutoSwapBufferMode
in interface com.jogamp.opengl.GLAutoDrawable
public boolean getAutoSwapBufferMode()
getAutoSwapBufferMode
in interface com.jogamp.opengl.GLAutoDrawable
public void swapBuffers()
swapBuffers
in interface com.jogamp.opengl.GLDrawable
public void setContextCreationFlags(int flags)
setContextCreationFlags
in interface com.jogamp.opengl.GLAutoDrawable
public int getContextCreationFlags()
getContextCreationFlags
in interface com.jogamp.opengl.GLAutoDrawable
public boolean shouldPreserveColorBufferIfTranslucent()
setOpaque
(false) has been called), indicates whether the application
should preserve the OpenGL color buffer (GL_COLOR_BUFFER_BIT) for correct
rendering of the GLJPanel and underlying widgets which may show through
portions of the GLJPanel with alpha values less than 1. Most Swing
implementations currently expect the GLJPanel to be completely cleared
(e.g., by glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT)
), but for certain optimized Swing
implementations which use OpenGL internally, it may be possible to
perform OpenGL rendering using the GLJPanel into the same OpenGL drawable
as the Swing implementation uses.public int getSurfaceWidth()
getSurfaceWidth
in interface com.jogamp.opengl.GLDrawable
public int getSurfaceHeight()
getSurfaceHeight
in interface com.jogamp.opengl.GLDrawable
public boolean isGLOriented()
Method returns a valid value only after the backend has been
initialized, either eagerly
or
manually via the first display call. Method always returns a valid value
when called from within a GLEventListener
.
isGLOriented
in interface com.jogamp.opengl.GLDrawable
public final void setSkipGLOrientationVerticalFlip(boolean v)
isGLOriented()
based vertical flip, which usually is
required by the offscreen backend, see details about vertical flip and FBO / GLSL vertical flip.
If set to true
, user needs to flip the OpenGL rendered
scene if isGLOriented()
== true, e.g. via the projection
matrix. See constraints of isGLOriented()
.
public final boolean getSkipGLOrientationVerticalFlip()
public com.jogamp.opengl.GLCapabilitiesImmutable getChosenGLCapabilities()
getChosenGLCapabilities
in interface com.jogamp.opengl.GLDrawable
public final com.jogamp.opengl.GLCapabilitiesImmutable getRequestedGLCapabilities()
getRequestedGLCapabilities
in interface com.jogamp.opengl.GLDrawable
public final void setRequestedGLCapabilities(com.jogamp.opengl.GLCapabilitiesImmutable caps)
GLCapabilitiesImmutable
for this GLJPanel
allowing reconfiguration.
Method shall be invoked from the AWT-EDT
thread
. In case it is not invoked on the AWT-EDT thread, an attempt is
made to do so.
Method will dispose a previous realized
GLContext and offscreen backend!
caps
- new capabilities.public final com.jogamp.opengl.GLProfile getGLProfile()
getGLProfile
in interface com.jogamp.opengl.GLDrawable
public com.jogamp.nativewindow.NativeSurface getNativeSurface()
getNativeSurface
in interface com.jogamp.nativewindow.NativeSurfaceHolder
getNativeSurface
in interface com.jogamp.opengl.GLDrawable
public long getHandle()
getHandle
in interface com.jogamp.opengl.GLDrawable
public final com.jogamp.opengl.GLDrawableFactory getFactory()
getFactory
in interface com.jogamp.opengl.GLDrawable
public final int getTextureUnit()
If implementation uses a texture-unit, it will be known only after the first initialization, i.e. display call.
public final void setTextureUnit(int v)
display()
call.
Defaults to 0
.
v
- requested texture unitgetTextureUnit()
public com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode getDefaultCloseOperation()
getDefaultCloseOperation
in interface com.jogamp.nativewindow.WindowClosingProtocol
public com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode op)
setDefaultCloseOperation
in interface com.jogamp.nativewindow.WindowClosingProtocol
public java.lang.String toString()
toString
in interface com.jogamp.opengl.GLDrawable
toString
in class java.awt.Component
public boolean canSetSurfaceScale()