28package com.jogamp.opengl.swt;
32import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
33import com.jogamp.nativewindow.AbstractGraphicsDevice;
34import com.jogamp.nativewindow.AbstractGraphicsScreen;
35import com.jogamp.nativewindow.GraphicsConfigurationFactory;
36import com.jogamp.nativewindow.NativeSurface;
37import com.jogamp.nativewindow.NativeWindowException;
38import com.jogamp.nativewindow.ProxySurface;
39import com.jogamp.nativewindow.UpstreamSurfaceHook;
40import com.jogamp.nativewindow.VisualIDHolder;
41import com.jogamp.nativewindow.VisualIDHolder.VIDType;
42import com.jogamp.opengl.GL;
43import com.jogamp.opengl.GLAnimatorControl;
44import com.jogamp.opengl.GLAutoDrawable;
45import com.jogamp.opengl.GLCapabilities;
46import com.jogamp.opengl.GLCapabilitiesChooser;
47import com.jogamp.opengl.GLCapabilitiesImmutable;
48import com.jogamp.opengl.GLContext;
49import com.jogamp.opengl.GLDrawable;
50import com.jogamp.opengl.GLDrawableFactory;
51import com.jogamp.opengl.GLEventListener;
52import com.jogamp.opengl.GLException;
53import com.jogamp.opengl.GLProfile;
54import com.jogamp.opengl.GLRunnable;
55import com.jogamp.opengl.GLSharedContextSetter;
56import com.jogamp.opengl.Threading;
58import jogamp.nativewindow.macosx.OSXUtil;
59import jogamp.nativewindow.x11.X11Util;
60import jogamp.opengl.Debug;
61import jogamp.opengl.GLContextImpl;
62import jogamp.opengl.GLDrawableHelper;
63import jogamp.opengl.GLDrawableImpl;
65import org.eclipse.swt.SWT;
66import org.eclipse.swt.graphics.Color;
67import org.eclipse.swt.graphics.Rectangle;
68import org.eclipse.swt.internal.DPIUtil;
69import org.eclipse.swt.layout.FillLayout;
70import org.eclipse.swt.widgets.Canvas;
71import org.eclipse.swt.widgets.Composite;
72import org.eclipse.swt.widgets.Display;
73import org.eclipse.swt.widgets.Event;
74import org.eclipse.swt.widgets.Listener;
75import org.eclipse.swt.widgets.Shell;
77import com.jogamp.common.GlueGenVersion;
78import com.jogamp.common.os.Platform;
79import com.jogamp.common.util.VersionUtil;
80import com.jogamp.common.util.locks.LockFactory;
81import com.jogamp.common.util.locks.RecursiveLock;
82import com.jogamp.nativewindow.swt.SWTAccessor;
83import com.jogamp.nativewindow.x11.X11GraphicsDevice;
84import com.jogamp.opengl.JoglVersion;
99 private static final boolean DEBUG = Debug.debug(
"GLCanvas");
113 private final RecursiveLock lock = LockFactory.createRecursiveLock();
114 private final GLDrawableHelper helper =
new GLDrawableHelper();
119 private volatile Rectangle clientAreaPixels, clientAreaWindow;
120 private volatile GLDrawableImpl drawable;
121 private volatile GLContextImpl context;
124 private final boolean useX11GTK;
125 private volatile long x11Window;
129 private int additionalCtxCreationFlags = 0;
133 private volatile boolean sendReshape;
135 private static String getThreadName() {
return Thread.currentThread().getName(); }
136 private static String toHexString(
final int v) {
return "0x"+Integer.toHexString(v); }
137 private static String toHexString(
final long v) {
return "0x"+Long.toHexString(v); }
142 private final Runnable initAction =
new Runnable() {
145 helper.init(
GLCanvas.this, !sendReshape);
154 private final Runnable displayAction =
new Runnable() {
158 helper.reshape(
GLCanvas.this, 0, 0, clientAreaPixels.width, clientAreaPixels.height);
166 private final Runnable makeCurrentAndDisplayOnGLAction =
new Runnable() {
169 final RecursiveLock _lock = lock;
173 helper.invokeGL(drawable, context, displayAction, initAction);
182 private final Runnable swapBuffersOnGLAction =
new Runnable() {
185 final RecursiveLock _lock = lock;
188 final boolean drawableOK =
null != drawable && drawable.isRealized();
189 if( drawableOK && !
GLCanvas.this.isDisposed() ) {
190 drawable.swapBuffers();
201 private final Runnable disposeOnEDTGLAction =
new Runnable() {
204 final RecursiveLock _lock = lock;
208 final boolean animatorPaused;
211 animatorPaused = animator.
pause();
213 animatorPaused =
false;
217 if(
null != context ) {
218 if( context.isCreated() ) {
221 helper.disposeGL(
GLCanvas.this, context,
true);
226 exceptionOnDisposeGL = gle;
232 Throwable exceptionOnUnrealize =
null;
233 if(
null != drawable ) {
235 drawable.setRealized(
false);
236 }
catch(
final Throwable re ) {
237 exceptionOnUnrealize = re;
242 Throwable exceptionOnDeviceClose =
null;
244 if( 0 != x11Window) {
249 }
catch (
final Throwable re) {
250 exceptionOnDeviceClose = re;
253 if (animatorPaused) {
258 if(
null != exceptionOnDisposeGL ) {
259 throw exceptionOnDisposeGL;
261 if(
null != exceptionOnUnrealize ) {
264 if(
null != exceptionOnDeviceClose ) {
273 private class DisposeGLEventListenerAction
implements Runnable {
275 private final boolean remove;
276 private DisposeGLEventListenerAction(
final GLEventListener listener,
final boolean remove) {
277 this.listener = listener;
278 this.remove =
remove;
283 final RecursiveLock _lock = lock;
287 listener = helper.disposeGLEventListener(
GLCanvas.this, drawable, context, listener,
remove);
316 parent.getDisplay().syncExec(
new Runnable() {
319 res[0] =
new GLCanvas( parent, style, caps, chooser );
344 super(parent, style | SWT.NO_BACKGROUND);
351 clientAreaWindow = getClientArea();
360 final long x11DeviceHandle = X11Util.openDisplay(swtDevice.
getConnection());
361 if( 0 == x11DeviceHandle ) {
362 throw new RuntimeException(
"Error creating display(EDT): "+swtDevice.
getConnection());
371 if(
null == capsReqUser) {
376 this.capsChooser = capsChooser;
388 setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
390 final Listener listener =
new Listener () {
392 public void handleEvent (
final Event event) {
393 switch (event.type) {
395 displayIfNoAnimatorNoCheck();
398 if (DEBUG) { System.err.println(getThreadName()+
": SWT.GLCanvas.Resize.0 "+
toString()); }
401 case SWT.ZoomChanged:
402 if (DEBUG) { System.err.println(getThreadName()+
": SWT.GLCanvas.ZoomChanged.0 "+
toString()); }
406 if (DEBUG) { System.err.println(getThreadName()+
": SWT.GLCanvas.Dispose.0 "+
toString()); }
412 addListener (SWT.Resize, listener);
413 addListener (SWT.Paint, listener);
414 addListener (SWT.Dispose, listener);
419 helper.setSharedContext(this.context, sharedContext);
424 helper.setSharedAutoDrawable(
this, sharedAutoDrawable);
436 return clientAreaPixels.width;
441 return clientAreaPixels.height;
446 return "SWTCanvasUpstreamSurfaceHook[upstream: "+
GLCanvas.this.toString()+
", "+clientAreaPixels.width+
"x"+clientAreaPixels.height+
" [pixel], "+clientAreaWindow.width+
"x"+clientAreaWindow.height+
" [win]]";
456 public final NativeSurface getUpstreamSurface() {
462 final Rectangle oClientAreaPixels = clientAreaPixels;
466 System.err.println(getThreadName()+
": GLCanvas.sizeChanged: clientAreaPixels.o "+getClientArea());
467 System.err.println(getThreadName()+
": GLCanvas.sizeChanged: clientAreaPixels.n "+nClientAreaPixels);
470 if ( nClientAreaPixels !=
null &&
471 ( nClientAreaPixels.width != oClientAreaPixels.width || nClientAreaPixels.height != oClientAreaPixels.height )
473 clientAreaPixels = nClientAreaPixels;
474 clientAreaWindow = getClientArea();
476 final GLDrawableImpl _drawable = drawable;
477 final boolean drawableOK =
null != _drawable && _drawable.isRealized();
479 final long dh = drawableOK ? _drawable.getHandle() : 0;
480 System.err.println(getThreadName()+
": GLCanvas.sizeChanged: ("+Thread.currentThread().getName()+
"): "+nClientAreaPixels.x+
"/"+nClientAreaPixels.y+
" "+nClientAreaPixels.width+
"x"+nClientAreaPixels.height+
" - drawableHandle "+toHexString(dh));
483 if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) {
484 final RecursiveLock _lock = lock;
487 final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, nClientAreaPixels.width, nClientAreaPixels.height);
488 if(_drawable != _drawableNew) {
490 drawable = _drawableNew;
504 private boolean isValidAndVisibleOnEDTActionResult;
505 private final Runnable isValidAndVisibleOnEDTAction =
new Runnable() {
508 isValidAndVisibleOnEDTActionResult = !
GLCanvas.this.isDisposed() &&
GLCanvas.this.isVisible();
511 private final boolean isValidAndVisibleOnEDT() {
512 synchronized(isValidAndVisibleOnEDTAction) {
513 runOnEDTIfAvail(
true, isValidAndVisibleOnEDTAction);
514 return isValidAndVisibleOnEDTActionResult;
520 if( !isValidAndVisibleOnEDT() ) {
523 return validateDrawableAndContextPostCheck();
526 private final boolean isDrawableAndContextValid() {
528 return null != drawable &&
null != context;
532 private final boolean validateDrawableAndContextPostCheck() {
534 final RecursiveLock _lock = lock;
537 if(
null == drawable) {
539 createDrawableImpl();
541 final GLDrawable _drawable = drawable;
542 if (
null != _drawable ) {
544 if(
null == context ) {
546 res = createContextImpl(_drawable);
555 System.err.println(getThreadName()+
": SWT.GLCanvas.validate "+toHexString(hashCode())+
": null drawable");
560 final boolean isDrawableNull =
null == drawable;
561 final boolean isDrawableRealized = !isDrawableNull ? drawable.isRealized() :
false;
562 System.err.println(getThreadName()+
": SWT.GLCanvas.validate.X "+toHexString(hashCode())+
": "+res+
", drawable[null "+isDrawableNull+
", realized "+isDrawableRealized+
"], has context "+(
null!=context));
569 private final void createDrawableImpl() {
570 final Rectangle nClientArea = clientAreaPixels;
571 if(0 >= nClientArea.width || 0 >= nClientArea.height) {
573 System.err.println(getThreadName()+
": SWT.GLCanvas.validate.X "+toHexString(hashCode())+
": drawable could not be created: size < 0x0");
577 final AbstractGraphicsDevice device = screen.
getDevice();
580 final long nativeWindowHandle;
582 final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(device, capsRequested);
583 final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(
584 capsRequested, capsRequested, capsChooser, screen, VisualIDHolder.VID_UNDEFINED);
586 System.err.println(getThreadName()+
": SWT.GLCanvas.X11 "+toHexString(hashCode())+
": factory: "+factory+
", chosen config: "+cfg);
589 throw new NativeWindowException(
"Error choosing GraphicsConfiguration creating window: "+
this);
591 final int visualID = cfg.getVisualID(VIDType.NATIVE);
592 if( VisualIDHolder.VID_UNDEFINED != visualID ) {
595 x11Window = SWTAccessor.createCompatibleX11ChildWindow(screen,
this, visualID, clientAreaPixels.width, clientAreaPixels.height);
596 nativeWindowHandle = x11Window;
598 throw new GLException(
"Could not choose valid visualID: "+toHexString(visualID)+
", "+
this);
601 nativeWindowHandle = SWTAccessor.getWindowHandle(
this);
602 if( SWTAccessor.isOSX ) {
603 final float reqPixelScale = DPIUtil.autoScaleUp(
this, 1f);
605 System.err.println(getThreadName()+
": SWT.GLCanvas.OSX "+toHexString(hashCode())+
": Scaling: devZoom "+DPIUtil.getDeviceZoom()+
", general "+DPIUtil.autoScaleUp(1f)+
", onWidged "+reqPixelScale);
607 if( reqPixelScale > 1f ) {
608 OSXUtil.SetWindowPixelScale(nativeWindowHandle, reqPixelScale);
612 final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(capsRequested.
getGLProfile());
615 final ProxySurface proxySurface = glFactory.createProxySurface(device, screen.
getIndex(), nativeWindowHandle,
616 capsRequested, capsChooser, swtCanvasUpStreamHook);
618 final GLDrawableImpl _drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface);
619 _drawable.setRealized(
true);
620 if(!_drawable.isRealized()) {
623 System.err.println(getThreadName()+
": SWT.GLCanvas.validate.X "+proxySurface);
624 System.err.println(getThreadName()+
": SWT.GLCanvas.validate.X "+toHexString(hashCode())+
": Drawable could not be realized: "+_drawable);
628 System.err.println(getThreadName()+
": SWT.GLCanvas.validate "+proxySurface);
629 System.err.println(getThreadName()+
": SWT.GLCanvas.validate "+toHexString(hashCode())+
": Drawable created and realized: "+_drawable);
631 drawable = _drawable;
634 private boolean createContextImpl(
final GLDrawable drawable) {
635 final GLContext[] shareWith = {
null };
636 if( !helper.isSharedGLContextPending(shareWith) ) {
637 context = (GLContextImpl) drawable.createContext(shareWith[0]);
638 context.setContextCreationFlags(additionalCtxCreationFlags);
640 System.err.println(getThreadName()+
": SWT.GLCanvas.validate "+toHexString(hashCode())+
": Context created: has shared "+(
null != shareWith[0]));
645 System.err.println(getThreadName()+
": SWT.GLCanvas.validate "+toHexString(hashCode())+
": Context !created: pending share");
669 runInGLThread(disposeOnEDTGLAction);
673 private final void displayIfNoAnimatorNoCheck() {
674 if ( !helper.isAnimatorAnimatingOnOtherThread() ) {
675 if( isDrawableAndContextValid() || validateDrawableAndContextPostCheck() ) {
676 runInGLThread(makeCurrentAndDisplayOnGLAction);
688 runInGLThread(makeCurrentAndDisplayOnGLAction);
702 return clientAreaPixels.width;
707 return clientAreaPixels.height;
713 return null != _drawable ? _drawable.
isGLOriented() :
true;
718 helper.addGLEventListener(listener);
723 helper.addGLEventListener(idx, listener);
728 return helper.getGLEventListenerCount();
733 return helper.getGLEventListener(index);
738 return helper.areAllGLEventListenerInitialized();
743 return helper.getGLEventListenerInitState(listener);
748 helper.setGLEventListenerInitState(listener, initialized);
753 final DisposeGLEventListenerAction r =
new DisposeGLEventListenerAction(listener,
remove);
760 return helper.removeGLEventListener(listener);
778 return helper.getAnimator();
783 return helper.setExclusiveContextThread(t, context);
788 return helper.getExclusiveContextThread();
793 return helper.getAutoSwapBufferMode();
808 return additionalCtxCreationFlags;
814 return (
null == _context) ? null : _context.
getGL();
818 public boolean invoke(
final boolean wait,
final GLRunnable runnable)
throws IllegalStateException {
819 return helper.invoke(
this, wait, runnable);
823 public boolean invoke(
final boolean wait,
final List<GLRunnable> runnables)
throws IllegalStateException {
824 return helper.invoke(
this, wait, runnables);
829 helper.flushGLRunnables();
834 helper.setAnimator(arg0);
839 helper.setAutoSwapBufferMode(arg0);
844 final RecursiveLock _lock = lock;
848 GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
849 context=(GLContextImpl)newCtx;
858 additionalCtxCreationFlags = arg0;
860 if(
null != _context) {
868 if (
null != _context) {
869 _context.
setGL(arg0);
877 final RecursiveLock _lock = lock;
880 if(drawable !=
null) {
881 final GLContext _ctx = drawable.createContext(shareWith);
906 return (_drawable !=
null) ? _drawable.
getFactory() :
null;
917 return (_drawable !=
null) ? _drawable.
getHandle() : 0;
929 return (_drawable !=
null) ? _drawable.
isRealized() :
false;
939 runInGLThread(swapBuffersOnGLAction);
973 private void runInGLThread(
final Runnable action) {
992 private void runOnEDTIfAvail(
final boolean wait,
final Runnable action) {
993 final Display d = isDisposed() ? null : getDisplay();
994 if(
null == d || d.isDisposed() || d.getThread() == Thread.currentThread() ) {
1009 return "SWT-GLCanvas[Realized "+
isRealized()+
1010 ",\n\t"+((
null!=_drawable)?_drawable.getClass().getName():
"null-drawable")+
1012 ",\n\thandle "+toHexString(
getHandle())+
1013 ",\n\tDrawable size "+dw+
"x"+dh+
1017 public static void main(
final String[] args) {
1018 System.err.println(VersionUtil.getPlatformInfo());
1019 System.err.println(GlueGenVersion.getInstance());
1026 final Display
display =
new Display();
1027 final Shell shell =
new Shell(
display);
1028 shell.setSize(128,128);
1029 shell.setLayout(
new FillLayout());
1036 final GL gl = drawable.
getGL();
1040 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {}
static void destroyX11Window(final AbstractGraphicsDevice device, final long x11Window)
static Rectangle getClientAreaInPixels(final Scrollable s)
Returns the unscaled Scrollable#getClientArea() in pixels.
static AbstractGraphicsDevice getDevice(final Control swtControl)
static AbstractGraphicsScreen getScreen(final AbstractGraphicsDevice device, final int screen)
static void resizeX11Window(final AbstractGraphicsDevice device, final Rectangle clientArea, final long x11Window)
static void setRealized(final Control swtControl, final boolean realize)
static boolean useX11GTK()
Encapsulates a graphics device on X11 platforms.
Specifies a set of OpenGL capabilities.
Abstraction for an OpenGL rendering context.
abstract void setContextCreationFlags(int flags)
abstract GL setGL(GL gl)
Sets the GL pipeline object for this GLContext.
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
static GLException newGLException(final Throwable t)
Constructs a GLException object with the specified root cause with a decorating message including the...
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
static AbstractGraphicsDevice getDefaultDevice()
static void initSingleton()
Static initialization of JOGL.
static JoglVersion getInstance()
static StringBuilder getGLInfo(final GL gl, final StringBuilder sb)
static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, final boolean withCapabilitiesInfo)
Native SWT Canvas implementing GLAutoDrawable.
GLEventListener removeGLEventListener(final GLEventListener listener)
Removes the given listener from this drawable queue.
final GLDrawable getDelegatedDrawable()
If the implementation uses delegation, return the delegated GLDrawable instance, otherwise return thi...
void setAutoSwapBufferMode(final boolean arg0)
Enables or disables automatic buffer swapping for this drawable.
GLProfile getGLProfile()
Fetches the GLProfile for this drawable.
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
int getContextCreationFlags()
final RecursiveLock getUpstreamLock()
Returns the recursive lock object of the upstream widget to synchronize multithreaded access on top o...
GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx)
Associate the new context, newtCtx, to this auto-drawable.
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext....
static void main(final String[] args)
boolean invoke(final boolean wait, final GLRunnable runnable)
Enqueues a one-shot GLRunnable, which will be executed within the next display() call after all regis...
long getHandle()
Returns the GL drawable handle, guaranteed to be valid after realization and while it's surface is be...
GLCanvas(final Composite parent, final int style, final GLCapabilitiesImmutable capsReqUser, final GLCapabilitiesChooser capsChooser)
Creates a new SWT GLCanvas.
GLContext getContext()
Returns the context associated with this drawable.
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.Returns the underlying NativeSurface...
void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized)
Sets the given listener's initialized state.
boolean areAllGLEventListenerInitialized()
Returns true if all added GLEventListener are initialized, otherwise false.
void addGLEventListener(final int idx, final GLEventListener listener)
Adds the given listener at the given index of this drawable queue.
int getGLEventListenerCount()
Returns the number of GLEventListener of this drawable queue.
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove)
Disposes the given listener via dispose(..) if it has been initialized and added to this queue.
boolean invoke(final boolean wait, final List< GLRunnable > runnables)
Extends invoke(boolean, GLRunnable) functionality allowing to inject a list of GLRunnables.
boolean isGLOriented()
Returns true if the drawable is rendered in OpenGL's coordinate system, origin at bottom left.
static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps, final GLCapabilitiesChooser chooser)
Creates an instance using GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser) on...
GL setGL(final GL arg0)
Sets the GL pipeline object this GLAutoDrawable uses.
GLEventListener getGLEventListener(final int index)
Returns the GLEventListener at the given index of this drawable queue.
void setRealized(final boolean arg0)
Indicates to GLDrawable implementations whether the underlying surface has been created and can be dr...
GLCapabilitiesImmutable getRequestedGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the user requested OpenGL capabilities (pixel fo...
final Object getUpstreamWidget()
Method may return the upstream UI toolkit object holding this GLAutoDrawable instance,...
final Thread getExclusiveContextThread()
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
final void updateSizeCheck()
boolean getAutoSwapBufferMode()
Indicates whether automatic buffer swapping is enabled for this drawable.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
boolean getGLEventListenerInitState(final GLEventListener listener)
Retrieves whether the given listener is initialized or not.
void flushGLRunnables()
Flushes all enqueued GLRunnable of this GLAutoDrawable including notifying waiting executor.
final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable)
Specifies an GLAutoDrawable, which OpenGL context shall be shared by this GLAutoDrawable's GLContext.
final boolean isThreadGLCapable()
Indicates whether the current thread is capable of performing OpenGL-related work....
final Thread setExclusiveContextThread(final Thread t)
Dedicates this instance's GLContext to the given thread.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
final void setSharedContext(final GLContext sharedContext)
Specifies an OpenGL context, which shall be shared by this GLAutoDrawable's GLContext.
void dispose()
@Override public boolean forceFocus() { final boolean r = super.forceFocus(); if(r && 0 !...
GLContext createContext(final GLContext shareWith)
Creates a new context for drawing to this drawable that will optionally share buffer objects,...
GLAnimatorControl getAnimator()
final boolean validateDrawableAndContextWithCheck()
assumes drawable == null (implying !drawable.isRealized()) ! Checks of !isDispose() and isVisible()
void swapBuffers()
Swaps the front and back buffers of this drawable.
void setContextCreationFlags(final int arg0)
GLDrawableFactory getFactory()
Return the GLDrawableFactory being used to create this instance.
void setAnimator(final GLAnimatorControl arg0)
Registers the usage of an animator, an com.jogamp.opengl.GLAnimatorControl implementation.
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
A interface describing a graphics device in a toolkit-independent manner.
boolean close()
Optionally closing the device if handle is not null.
boolean open()
Optionally [re]opening the device if handle is null.
static int DEFAULT_UNIT
Default unit id for the 1st device: 0.
String getConnection()
Returns the semantic GraphicsDevice connection.
A interface describing a graphics screen in a toolkit-independent manner.
int getIndex()
Returns the screen index this graphics screen is valid for.
AbstractGraphicsDevice getDevice()
Return the device this graphics configuration is valid for.
Provides low-level information required for hardware-accelerated rendering using a surface in a platf...
Provides a mutable NativeSurface, i.e.
Interface allowing upstream caller to pass lifecycle actions and size info to a ProxySurface instance...
An animator control interface, which implementation may drive a com.jogamp.opengl....
boolean resume()
Resumes animation if paused.
boolean pause()
Pauses this animator.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
Provides a mechanism by which applications can customize the window type selection for a given GLCapa...
Specifies an immutable set of OpenGL capabilities.
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
An abstraction for an OpenGL rendering target.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
GLCapabilitiesImmutable getRequestedGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the user requested OpenGL capabilities (pixel fo...
long getHandle()
Returns the GL drawable handle, guaranteed to be valid after realization and while it's surface is be...
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
boolean isGLOriented()
Returns true if the drawable is rendered in OpenGL's coordinate system, origin at bottom left.
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.
GLDrawableFactory getFactory()
Return the GLDrawableFactory being used to create this instance.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
Adds capabilities to set a shared GLContext directly or via an GLAutoDrawable.