com.sun.opengl.impl.x11

Class X11GLDrawableFactory

Implemented Interfaces:
DynamicLookupHelper

public class X11GLDrawableFactory
extends GLDrawableFactoryImpl

Constructor Summary

X11GLDrawableFactory()

Method Summary

boolean
canCreateExternalGLDrawable()
Returns true if it is possible to create an external GLDrawable object via GLDrawableFactory.createExternalGLDrawable().
boolean
canCreateGLPbuffer()
Returns true if it is possible to create a GLPbuffer.
AbstractGraphicsConfiguration
chooseGraphicsConfiguration(GLCapabilities capabilities, GLCapabilitiesChooser chooser, AbstractGraphicsDevice absDevice)
Selects a graphics configuration on the specified graphics device compatible with the supplied GLCapabilities.
GLContext
createExternalGLContext()
Creates a GLContext object representing an existing OpenGL context in an external (third-party) OpenGL-based library.
GLDrawable
createExternalGLDrawable()
Creates a GLDrawable object representing an existing OpenGL drawable in an external (third-party) OpenGL-based library.
GLPbuffer
createGLPbuffer(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int initialWidth, int initialHeight, GLContext shareWith)
Creates a GLPbuffer with the given capabilites and dimensions.
GLDrawableImpl
createOffscreenDrawable(GLCapabilities capabilities, GLCapabilitiesChooser chooser)
Creates a (typically software-accelerated) offscreen GLDrawable used to implement the fallback rendering path of the GLJPanel.
long
dynamicLookupFunction(String glFuncName)
Dynamically looks up the given function.
static long
getDisplayConnection()
GLDrawable
getGLDrawable(Object target, GLCapabilities capabilities, GLCapabilitiesChooser chooser)
Returns a GLDrawable that wraps a platform-specific window system object, such as an AWT or LCDUI Canvas.
protected Buffer
getGammaRamp()
Gets the current gamma ramp.
protected int
getGammaRampLength()
Returns the length of the computed gamma ramp for this OS and hardware.
static X11GLDrawableFactory
getX11Factory()
static int[]
glCapabilities2AttribList(GLCapabilities caps, boolean isMultisampleAvailable, boolean pbuffer, long display, int screen)
static int
glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp, int tmp_offset)
static boolean
isMultisampleAvailable()
static boolean
isVendorATI()
Workaround for apparent issue with ATI's proprietary drivers where direct contexts still send GLX tokens for GL calls
protected boolean
isXineramaEnabled()
void
loadGLULibrary()
void
lockAWTForJava2D()
Locks the AWT for the purposes of Java2D/JOGL integration.
void
lockToolkit()
protected void
resetGammaRamp(Buffer originalGammaRamp)
Resets the gamma ramp, potentially using the specified Buffer as data to restore the original values.
protected boolean
setGammaRamp(float[] ramp)
Sets the gamma ramp for the main screen.
void
unlockAWTForJava2D()
Unlocks the AWT for the purposes of Java2D/JOGL integration.
void
unlockToolkit()
static GLCapabilities
xvi2GLCapabilities(long display, XVisualInfo info)

Methods inherited from class com.sun.opengl.impl.GLDrawableFactoryImpl

createOffscreenDrawable, dynamicLookupFunction, getFactoryImpl, getGammaRamp, getGammaRampLength, loadGLULibrary, lockAWTForJava2D, resetDisplayGamma, resetGammaRamp, setDisplayGamma, setGammaRamp, unlockAWTForJava2D

Methods inherited from class javax.media.opengl.GLDrawableFactory

canCreateExternalGLDrawable, canCreateGLPbuffer, chooseGraphicsConfiguration, createExternalGLContext, createExternalGLDrawable, createGLPbuffer, getFactory, getGLDrawable

Constructor Details

X11GLDrawableFactory

public X11GLDrawableFactory()

Method Details

canCreateExternalGLDrawable

public boolean canCreateExternalGLDrawable()
Overrides:
canCreateExternalGLDrawable in interface GLDrawableFactory

canCreateGLPbuffer

public boolean canCreateGLPbuffer()
Returns true if it is possible to create a GLPbuffer. Some older graphics cards do not have this capability.
Overrides:
canCreateGLPbuffer in interface GLDrawableFactory

chooseGraphicsConfiguration

public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
                                                                 GLCapabilitiesChooser chooser,
                                                                 AbstractGraphicsDevice absDevice)
Selects a graphics configuration on the specified graphics device compatible with the supplied GLCapabilities. This method is intended to be used by applications which do not use the supplied GLCanvas class but instead wrap their own Canvas or other window toolkit-specific object with a GLDrawable. Some platforms (specifically X11) require the graphics configuration to be specified when the window toolkit object is created. This method may return null on platforms on which the OpenGL pixel format selection process is performed later.

The concrete data type of the passed graphics device and returned graphics configuration must be specified in the documentation binding this particular API to the underlying window toolkit. The Reference Implementation accepts AWTGraphicsDevice objects and returns AWTGraphicsConfiguration objects.

Overrides:
chooseGraphicsConfiguration in interface GLDrawableFactory

createExternalGLContext

public GLContext createExternalGLContext()
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 GL and GLU objects. New contexts created through GLDrawables may share textures and display lists with this external context.

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 makeCurrent and release on the returned GLContext object have no effect. If the underlying OpenGL context is destroyed, the destroy method should be called on the GLContext. A new GLContext object should be created for each newly-created underlying OpenGL context.

Overrides:
createExternalGLContext in interface GLDrawableFactory

createExternalGLDrawable

public GLDrawable createExternalGLDrawable()
Creates a GLDrawable object representing an existing OpenGL drawable in an external (third-party) OpenGL-based library. This GLDrawable object may be used to create new, fully-functional GLContexts on the OpenGL drawable. This is useful when interoperating with a third-party OpenGL-based library and it is essential to not perturb the state of the library's existing context, even to the point of not sharing textures or display lists with that context.

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 GLDrawable.createContext(GLContext), and the drawable is deleted by the third-party library, the user is responsible for calling GLContext.destroy() on these contexts.

Calls to setSize, getWidth and getHeight are illegal on the returned GLDrawable. If these operations are required by the user, they must be performed by the third-party library.

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 GLDrawableFactory.canCreateExternalGLDrawable() should be called first to see if it is present. For example, on X11 platforms, this API requires the presence of GLX 1.3 or later.

Overrides:
createExternalGLDrawable in interface GLDrawableFactory

createGLPbuffer

public GLPbuffer createGLPbuffer(GLCapabilities capabilities,
                                 GLCapabilitiesChooser chooser,
                                 int initialWidth,
                                 int initialHeight,
                                 GLContext shareWith)
Creates a GLPbuffer with the given capabilites and dimensions.

See the note in the overview documentation on context sharing.

Overrides:
createGLPbuffer in interface GLDrawableFactory

createOffscreenDrawable

public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities,
                                              GLCapabilitiesChooser chooser)
Creates a (typically software-accelerated) offscreen GLDrawable used to implement the fallback rendering path of the GLJPanel.
Overrides:
createOffscreenDrawable in interface GLDrawableFactoryImpl

dynamicLookupFunction

public long dynamicLookupFunction(String glFuncName)
Dynamically looks up the given function.
Overrides:
dynamicLookupFunction in interface GLDrawableFactoryImpl

getDisplayConnection

public static long getDisplayConnection()

getGLDrawable

public GLDrawable getGLDrawable(Object target,
                                GLCapabilities capabilities,
                                GLCapabilitiesChooser chooser)
Returns a GLDrawable that wraps a platform-specific window system object, such as an AWT or LCDUI Canvas. On platforms which support it, selects a pixel format compatible with the supplied GLCapabilities, or if the passed GLCapabilities object is null, uses a default set of capabilities. On these platforms, uses either the supplied GLCapabilitiesChooser object, or if the passed GLCapabilitiesChooser object is null, uses a DefaultGLCapabilitiesChooser instance.
Overrides:
getGLDrawable in interface GLDrawableFactory

getGammaRamp

protected Buffer getGammaRamp()
Gets the current gamma ramp. This is basically an opaque value used only on some platforms to reset the gamma ramp to its original settings.
Overrides:
getGammaRamp in interface GLDrawableFactoryImpl

getGammaRampLength

protected int getGammaRampLength()
Returns the length of the computed gamma ramp for this OS and hardware. Returns 0 if gamma changes are not supported.
Overrides:
getGammaRampLength in interface GLDrawableFactoryImpl

getX11Factory

public static X11GLDrawableFactory getX11Factory()

glCapabilities2AttribList

public static int[] glCapabilities2AttribList(GLCapabilities caps,
                                              boolean isMultisampleAvailable,
                                              boolean pbuffer,
                                              long display,
                                              int screen)

glXGetConfig

public static int glXGetConfig(long display,
                               XVisualInfo info,
                               int attrib,
                               int[] tmp,
                               int tmp_offset)

isMultisampleAvailable

public static boolean isMultisampleAvailable()

isVendorATI

public static boolean isVendorATI()
Workaround for apparent issue with ATI's proprietary drivers where direct contexts still send GLX tokens for GL calls

isXineramaEnabled

protected boolean isXineramaEnabled()

loadGLULibrary

public void loadGLULibrary()
Overrides:
loadGLULibrary in interface GLDrawableFactoryImpl

lockAWTForJava2D

public void lockAWTForJava2D()
Locks the AWT for the purposes of Java2D/JOGL integration. This is not necessary on some platforms.
Overrides:
lockAWTForJava2D in interface GLDrawableFactoryImpl

lockToolkit

public void lockToolkit()

resetGammaRamp

protected void resetGammaRamp(Buffer originalGammaRamp)
Resets the gamma ramp, potentially using the specified Buffer as data to restore the original values.
Overrides:
resetGammaRamp in interface GLDrawableFactoryImpl

setGammaRamp

protected boolean setGammaRamp(float[] ramp)
Sets the gamma ramp for the main screen. Returns false if gamma ramp changes were not supported.
Overrides:
setGammaRamp in interface GLDrawableFactoryImpl

unlockAWTForJava2D

public void unlockAWTForJava2D()
Unlocks the AWT for the purposes of Java2D/JOGL integration. This is not necessary on some platforms.
Overrides:
unlockAWTForJava2D in interface GLDrawableFactoryImpl

unlockToolkit

public void unlockToolkit()

xvi2GLCapabilities

public static GLCapabilities xvi2GLCapabilities(long display,
                                                XVisualInfo info)

Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.