Provides a virtual machine- and operating system-independent
mechanism for creating GLDrawables.
The com. objects passed
in to the various factory methods are used as a hint for the
properties of the returned drawable. The default capabilities
selection algorithm (equivalent to passing in a null GLCapabilitiesChooser) is described in DefaultGLCapabilitiesChooser. Sophisticated applications needing
to change the selection algorithm may pass in their own GLCapabilitiesChooser which can select from the available pixel
formats. The GLCapabilitiesChooser mechanism may not be supported
by all implementations or on all platforms, in which case any
passed GLCapabilitiesChooser will be ignored.
Because of the multithreaded nature of the Java platform's
Abstract Window Toolkit, it is typically not possible to immediately
reject a given GLCapabilities as being unsupportable by
either returning null from the creation routines or
raising a GLException. The semantics of the rejection
process are (unfortunately) left unspecified for now. The current
implementation will cause a GLException to be raised
during the first repaint of the com. or com. if the capabilities can not be met.
GLOffscreenAutoDrawable are created lazily,
see createOffscreenAutoDrawable(..
The concrete GLDrawableFactory subclass instantiated by getFactory can be changed by setting the system
property opengl.factory.class.name to the
fully-qualified name of the desired class.
| Modifier and Type | Field and Description |
|---|---|
| protected static final boolean | |
| private static GLDrawableFactory | |
| private static ArrayList | |
| private static volatile boolean | |
| private static GLDrawableFactory |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract boolean | canCreateExternalGLDrawable(AbstractGraphicsDevice
which device)connection denotes the shared the target device, may be null for the platform's default device.Returns true if it is possible to create an external GLDrawable
object via |
| public abstract boolean | canCreateFBO(AbstractGraphicsDevice
which device, GLProfile connection denotes the shared the target device, may be null for the platform's default device.GLProfile to check for FBO capabilitiesReturns true if it is possible to create an framebuffer object (FBO). |
| public abstract boolean | canCreateGLPbuffer(AbstractGraphicsDevice
which device, GLProfile connection denotes the shared the target device, may be null for the platform's default device.GLProfile to check for FBO capabilitiesReturns true if it is possible to create an pbuffer surface. |
| public abstract GLAutoDrawable | Returns: the created and realized dummyGLAutoDrawable instancewhich deviceReq, boolean connection denotes the shared device to be used, may be null for the platform's default device.if createNewDevice, GLCapabilitiesImmutable true a new independent device instance is created from the deviceReq, otherwise deviceReq is used as-is and must be valid!the desired capsRequested, GLCapabilitiesChooser GLCapabilitiesImmutable, incl. it's GLProfile.
For shared context, same GLCapabilitiesImmutable#getVisualID(com.
across shared drawables will yield best compatibility.the custom chooser, may be null for default chooser)Creates a |
| public abstract GLDrawable | Returns: the created unrealized dummyGLDrawablewhich deviceReq, boolean connection denotes the shared device to be used, may be null for the platform's default device.if createNewDevice, GLCapabilitiesImmutable true a new independent device instance is created from the deviceReq, otherwise deviceReq is used as-is and must be valid!the desired capsRequested, GLCapabilitiesChooser GLCapabilitiesImmutable, incl. it's GLProfile.
For shared context, same visual ID
or caps
across shared drawables will yield best compatibility.the custom chooser, may be null for default chooser)Creates an |
| public abstract GLContext | createExternalGLContext()
Creates a GLContext object representing an existing OpenGL context in an external (third-party) OpenGL-based library. |
| public abstract GLDrawable | createExternalGLDrawable()
Creates a |
| public abstract GLDrawable | createGLDrawable(NativeSurface target)
Returns an |
| public abstract GLOffscreenAutoDrawable | Returns: the created and realized offscreenGLOffscreenAutoDrawable instancewhich device, GLCapabilitiesImmutable connection denotes the shared device to be used, may be null for the platform's default device.the requested GLCapabilties caps, GLCapabilitiesChooser the custom chooser, may be null for default chooser, int the requested offscreen width width, int the requested offscreen height height)Creates a |
| public abstract GLDrawable | Returns: the created unrealized offscreenGLDrawablewhich device, GLCapabilitiesImmutable connection denotes the shared device to be used, may be null for the platform's default device.the requested GLCapabilties caps, GLCapabilitiesChooser the custom chooser, may be null for default chooser, int the requested offscreen width width, int the requested offscreen height height)Creates an |
| public abstract ProxySurface | Returns: the createdProxySurface instance w/ defined surface handle.which device, int connection denotes the shared the target device, may be null for the platform's default device.
Caller has to ensure it is compatible w/ the given windowHandlematching screen index of given screenIdx, long windowHandlethe native window handle windowHandle, GLCapabilitiesImmutable the requested GLCapabilties caps, GLCapabilitiesChooser the custom chooser, may be null for default chooser, UpstreamSurfaceHook optional upstream)UpstreamSurfaceHook allowing control of the ProxySurface's lifecycle and data it presents.Creates a proxy |
| protected final boolean | Returns: true if a shared resource could been created, otherwise false.which device)connection denotes the shared the target device, may be null for the platform's default device.Create the shared resource used internally as a reference for capabilities etc.
Returns true if a shared resource could be created
for the |
| protected abstract boolean | |
| protected void | |
| public final List | Returns: A list ofcom.'s, maybe empty if none is available.which device)connection denotes the shared the target device, may be null for the platform's default device.Returns an array of available GLCapabilities for the device. |
| protected abstract List | |
| public abstract AbstractGraphicsDevice | Returns: the default shared device for this factory, eg. :0.0 on X11 desktop.Retrieve the default |
| public static GLDrawableFactory | getDesktopFactory()
Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null |
| public static GLDrawableFactory | |
| public static GLDrawableFactory | getFactory(final GLProfile
GLProfile to determine the factory type, ie EGLDrawableFactory,
or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. glProfile)Returns the sole GLDrawableFactory instance. |
| protected static GLDrawableFactory | |
| protected static GLDrawableFactory | |
| public abstract boolean | Returns: true if the device is compatible with this factory, ie. if it can be used for GLDrawable creation. Otherwise false. This implies validation whether the implementation is functional.which device)connection denotes the shared the target device, may be null for the platform's default device.
|
| public abstract GLRendererQuirks | getRendererQuirks(AbstractGraphicsDevice
which device, final GLProfile glp)connection denotes the shared the target device, may be null for the platform's default device.Returns the shared resource's context |
| protected abstract Thread | Returns: the shared resource runner thread, if implementation uses it.Validate and start the shared resource runner thread if necessary and if the implementation uses it. |
| protected static String | |
| public abstract boolean | hasOpenGLDesktopSupport()
Method returns |
| public abstract boolean | hasOpenGLESSupport()
Method returns |
| public final boolean | hasRendererQuirk(final AbstractGraphicsDevice
which device, final GLProfile glp, final int connection denotes the shared the target device, may be null for the platform's default device.the quirk to be tested, e.g. quirk)GLRendererQuirks#NoDoubleBufferedPBuffer.Returns true if the |
| public static final void | |
| private static final void | |
| protected abstract boolean | |
| protected void | |
| public abstract void | resetAllDisplayGamma()
Resets the gamma, brightness and contrast values of all modified
displays to their original values before |
| protected abstract void | |
| public abstract void | resetDisplayGamma(final NativeSurface surface)
Resets the gamma, brightness and contrast values of the display associated with the given |
| public abstract boolean | Returns: true if gamma settings were successfully changed, false if notdenominates the display device surface, final float The gamma value, typically > 1.0 (default values vary, but typically roughly 1.0) gamma, final float The brightness value between -1.0 and 1.0, inclusive (default values vary, but typically 0) brightness, final float The contrast, greater than 0.0 (default values vary, but typically 1) contrast)Sets the gamma, brightness, and contrast of the display associated with the given |
| protected static void | |
| private static void | |
| protected abstract void | |
| protected final AbstractGraphicsDevice |
| DEBUG | back to summary |
|---|---|
| protected static final boolean DEBUG | |
| eglFactory | back to summary |
|---|---|
| private static GLDrawableFactory eglFactory | |
| glDrawableFactories | back to summary |
|---|---|
| private static ArrayList<GLDrawableFactory> glDrawableFactories | |
| isInit | back to summary |
|---|---|
| private static volatile boolean isInit | |
| nativeOSFactory | back to summary |
|---|---|
| private static GLDrawableFactory nativeOSFactory | |
| GLDrawableFactory | back to summary |
|---|---|
| protected GLDrawableFactory() | |
| canCreateExternalGLDrawable | back to summary |
|---|---|
| public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) Returns true if it is possible to create an external GLDrawable
object via
| |
| canCreateFBO | back to summary |
|---|---|
| public abstract boolean canCreateFBO(AbstractGraphicsDevice device, GLProfile glp) Returns true if it is possible to create an framebuffer object (FBO).
FBO feature is implemented in OpenGL, hence it is
FBO support is queried as described in
| |
| canCreateGLPbuffer | back to summary |
|---|---|
| public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) Returns true if it is possible to create an pbuffer surface. Some older graphics cards do not have this capability, as well as some new GL implementation, i.e. OpenGL 3 core on OSX.
| |
| createDummyAutoDrawable | back to summary |
|---|---|
| public abstract GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) Creates a
The dummy
| |
| createDummyDrawable | back to summary |
|---|---|
| public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) Creates an
It is used to allow the creation of a
| |
| createExternalGLContext | back to summary |
|---|---|
| public abstract GLContext createExternalGLContext() throws GLException Creates a GLContext object representing an existing OpenGL
context in an external (third-party) OpenGL-based library. This
GLContext object may be used to draw into this preexisting
context using its The underlying OpenGL context must be current on the current
thread at the time this method is called. The user is responsible
for the maintenance of the underlying OpenGL context; calls to
| |
| createExternalGLDrawable | back to summary |
|---|---|
| public abstract GLDrawable createExternalGLDrawable() throws GLException Creates a An underlying OpenGL context must be current on the desired
drawable and the current thread at the time this method is
called. The user is responsible for the maintenance of the
underlying drawable. If one or more contexts are created on the
drawable using Calls to It is legal to create both an external GLContext and GLDrawable representing the same third-party OpenGL entities. This can be used, for example, to query current state information using the external GLContext and then create and set up new GLContexts using the external GLDrawable. This functionality may not be available on all platforms and
| |
| createOffscreenAutoDrawable | back to summary |
|---|---|
| public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height) throws GLException Creates a
The
In case the passed
A FBO based auto drawable,
A Pbuffer based auto drawable is created if both If neither FBO nor Pbuffer is available, a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
The resulting
| |
| createOffscreenDrawable | back to summary |
|---|---|
| public abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height) throws GLException Creates an
In case the passed
A resizeable FBO drawable,
A Pbuffer drawable is created if both If neither FBO nor Pbuffer is available, a simple pixmap/bitmap drawable is created, which is unlikely to be hardware accelerated.
The resulting
| |
| createProxySurface | back to summary |
|---|---|
| public abstract ProxySurface createProxySurface(AbstractGraphicsDevice device, int screenIdx, long windowHandle, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) Creates a proxy
It's
Lifecycle (creation and destruction) of the given surface handle shall be handled by the caller
via
Such surface can be used to instantiate a GLDrawable. With the help of
The resulting
| |
| createSharedResource | back to summary |
|---|---|
| protected final boolean createSharedResource(final AbstractGraphicsDevice device) Create the shared resource used internally as a reference for capabilities etc.
Returns true if a shared resource could be created
for the
| |
| createSharedResourceImpl | back to summary |
|---|---|
| protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device) | |
| enterThreadCriticalZone | back to summary |
|---|---|
| protected void enterThreadCriticalZone() | |
| getAvailableCapabilities | back to summary |
|---|---|
| public final List Returns an array of available GLCapabilities for the device.
| |
| getAvailableCapabilitiesImpl | back to summary |
|---|---|
| protected abstract List | |
| getDefaultDevice | back to summary |
|---|---|
| public abstract AbstractGraphicsDevice getDefaultDevice() Retrieve the default This method shall return the default device if available even if the GLDrawableFactory is not functional and hence not compatible. The latter situation may happen because no native OpenGL implementation is available for the specific implementation.
| |
| getDesktopFactory | back to summary |
|---|---|
| public static GLDrawableFactory getDesktopFactory() Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null | |
| getEGLFactory | back to summary |
|---|---|
| public static GLDrawableFactory getEGLFactory() Returns the sole GLDrawableFactory instance for EGL if exist or null | |
| getFactory | back to summary |
|---|---|
| public static GLDrawableFactory getFactory(final GLProfile glProfile) throws GLException Returns the sole GLDrawableFactory instance.
| |
| getFactoryImpl | back to summary |
|---|---|
| protected static GLDrawableFactory getFactoryImpl(final String glProfileImplName) throws GLException | |
| getFactoryImpl | back to summary |
|---|---|
| protected static GLDrawableFactory getFactoryImpl(final AbstractGraphicsDevice device) throws GLException | |
| getIsDeviceCompatible | back to summary |
|---|---|
public abstract boolean getIsDeviceCompatible(AbstractGraphicsDevice device)
| |
| getRendererQuirks | back to summary |
|---|---|
| public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device, final GLProfile glp) Returns the shared resource's context
Implementation calls
In case no shared device exist yet or the implementation doesn't support tracking quirks,
the result is always
| |
| getSharedResourceThread | back to summary |
|---|---|
| protected abstract Thread getSharedResourceThread() Validate and start the shared resource runner thread if necessary and if the implementation uses it.
| |
| getThreadName | back to summary |
|---|---|
| protected static String getThreadName() | |
| hasOpenGLDesktopSupport | back to summary |
|---|---|
| public abstract boolean hasOpenGLDesktopSupport() Method returns | |
| hasOpenGLESSupport | back to summary |
|---|---|
| public abstract boolean hasOpenGLESSupport() Method returns | |
| hasRendererQuirk | back to summary |
|---|---|
| public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final GLProfile glp, final int quirk) Returns true if the Convenience method for:
final GLRendererQuirks glrq = factory.getRendererQuirks(device);
return null != glrq ? glrq.exist(quirk) : false;
| |
| initSingleton | back to summary |
|---|---|
| public static final void initSingleton() Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones. | |
| initSingletonImpl | back to summary |
|---|---|
| private static final void initSingletonImpl() | |
| isComplete | back to summary |
|---|---|
| protected abstract boolean isComplete() Returns true if this factory is complete, i.e. ready to be used. Otherwise return false. | |
| leaveThreadCriticalZone | back to summary |
|---|---|
| protected void leaveThreadCriticalZone() | |
| resetAllDisplayGamma | back to summary |
|---|---|
| public abstract void resetAllDisplayGamma() Resets the gamma, brightness and contrast values of all modified
displays to their original values before While it is not explicitly required that this method be called before exiting manually, calling it is recommended because of the inevitable unspecified behavior during JVM teardown. | |
| resetAllDisplayGammaNoSync | back to summary |
|---|---|
| protected abstract void resetAllDisplayGammaNoSync() | |
| resetDisplayGamma | back to summary |
|---|---|
| public abstract void resetDisplayGamma(final NativeSurface surface) Resets the gamma, brightness and contrast values of the display associated with the given While it is not explicitly required that this method be called before exiting manually, calling it is recommended because of the inevitable unspecified behavior during JVM teardown. | |
| setDisplayGamma | back to summary |
|---|---|
| public abstract boolean setDisplayGamma(final NativeSurface surface, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException Sets the gamma, brightness, and contrast of the display associated with the given This functionality is not available on all platforms and graphics hardware. Returns true if the settings were successfully changed, false if not. This method may return false for some values of the incoming arguments even on hardware which does support the underlying functionality.
If this method returns true, the display settings will
automatically be reset to their original values upon JVM exit
(assuming the JVM does not crash); if the user wishes to change
the display settings back to normal ahead of time,
use
It is recommended to call
This method may be called multiple times during the application's
execution, but calling
| |
| shutdown | back to summary |
|---|---|
| protected static void shutdown() | |
| shutdown0 | back to summary |
|---|---|
| private static void shutdown0() | |
| shutdownImpl | back to summary |
|---|---|
| protected abstract void shutdownImpl() | |
| validateDevice | back to summary |
|---|---|
| protected final AbstractGraphicsDevice validateDevice(AbstractGraphicsDevice device) | |