com.jogamp.opengl.impl.x11.glx
Class X11GLXGraphicsConfigurationFactory

java.lang.Object
  extended by javax.media.nativewindow.GraphicsConfigurationFactory
      extended by com.jogamp.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory

public class X11GLXGraphicsConfigurationFactory
extends GraphicsConfigurationFactory

Subclass of GraphicsConfigurationFactory used when non-AWT tookits are used on X11 platforms. Toolkits will likely need to delegate to this one to change the accepted and returned types of the GraphicsDevice and GraphicsConfiguration abstractions.


Field Summary
protected static boolean DEBUG
           
 
Constructor Summary
X11GLXGraphicsConfigurationFactory()
           
 
Method Summary
 AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen)
           Selects a graphics configuration on the specified graphics device compatible with the supplied Capabilities.
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilities capabilities, GLCapabilitiesChooser chooser, X11GraphicsScreen x11Screen)
           
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen)
          protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfigurationFBConfig(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } X11GraphicsScreen x11Screen = (X11GraphicsScreen)absScreen; GLProfile glProfile = GLProfile.getDefault(); GLCapabilities caps=null; XVisualInfo xvis=null; long fbcfg = 0; int fbid = -1; // Utilizing FBConfig // GLCapabilities capsFB = null; long display = x11Screen.getDevice().getHandle(); try { int screen = x11Screen.getIndex(); boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display); long visID = X11Lib.DefaultVisualID(display, x11Screen.getIndex()); xvis = X11GLXGraphicsConfiguration.XVisualID2XVisualInfo(display, visID); caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, xvis, onscreen, usePBuffer, isMultisampleAvailable); int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(caps, true, isMultisampleAvailable, display, screen); int[] count = { -1 }; PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, 0, count, 0); if (fbcfgsL == null || fbcfgsL.limit()<1) { throw new Exception("Could not fetch FBConfig for "+caps); } fbcfg = fbcfgsL.get(0); capsFB = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfg, true, onscreen, usePBuffer, isMultisampleAvailable); fbid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg); xvis = GLX.glXGetVisualFromFBConfig(display, fbcfg); if (xvis==null) { throw new GLException("Error: Choosen FBConfig has no visual"); } } catch (Throwable t) { } return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:caps, caps, null, xvis, fbcfg, fbid); }
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilities capabilities, GLCapabilitiesChooser chooser, X11GraphicsScreen x11Screen)
           
static String toHexString(int val)
           
static String toHexString(long val)
           
 
Methods inherited from class javax.media.nativewindow.GraphicsConfigurationFactory
getFactory, getFactory, registerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

protected static final boolean DEBUG
Constructor Detail

X11GLXGraphicsConfigurationFactory

public X11GLXGraphicsConfigurationFactory()
Method Detail

chooseGraphicsConfiguration

public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities,
                                                                 CapabilitiesChooser chooser,
                                                                 AbstractGraphicsScreen absScreen)
Description copied from class: GraphicsConfigurationFactory

Selects a graphics configuration on the specified graphics device compatible with the supplied Capabilities. Some platforms (e.g.: X11, EGL, KD) require the graphics configuration to be specified when the native window is created. These architectures have seperated their device, screen, window and drawable context and hence are capable of quering the capabilities for each screen. A fully established window is not required.

Other platforms (e.g. Windows, MacOSX) don't offer the mentioned seperation and hence need a fully established window and it's drawable. Here the validation of the capabilities is performed later. In this case, the AbstractGraphicsConfiguration implementation must allow an overwrite of the Capabilites, for example DefaultGraphicsConfiguration.setChosenCapabilities(..).

This method is mainly intended to be both used and implemented by the OpenGL binding.

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. On X11 platforms where the AWT is not in use, it also accepts X11GraphicsDevice objects and returns X11GraphicsConfiguration objects.

Specified by:
chooseGraphicsConfiguration in class GraphicsConfigurationFactory
See Also:
GraphicsConfigurationFactory.chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen), DefaultGraphicsConfiguration.setChosenCapabilities(Capabilities caps)

chooseGraphicsConfigurationStatic

protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities,
                                                                               CapabilitiesChooser chooser,
                                                                               AbstractGraphicsScreen absScreen)
protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfigurationFBConfig(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } X11GraphicsScreen x11Screen = (X11GraphicsScreen)absScreen; GLProfile glProfile = GLProfile.getDefault(); GLCapabilities caps=null; XVisualInfo xvis=null; long fbcfg = 0; int fbid = -1; // Utilizing FBConfig // GLCapabilities capsFB = null; long display = x11Screen.getDevice().getHandle(); try { int screen = x11Screen.getIndex(); boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display); long visID = X11Lib.DefaultVisualID(display, x11Screen.getIndex()); xvis = X11GLXGraphicsConfiguration.XVisualID2XVisualInfo(display, visID); caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, xvis, onscreen, usePBuffer, isMultisampleAvailable); int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(caps, true, isMultisampleAvailable, display, screen); int[] count = { -1 }; PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, 0, count, 0); if (fbcfgsL == null || fbcfgsL.limit()<1) { throw new Exception("Could not fetch FBConfig for "+caps); } fbcfg = fbcfgsL.get(0); capsFB = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfg, true, onscreen, usePBuffer, isMultisampleAvailable); fbid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg); xvis = GLX.glXGetVisualFromFBConfig(display, fbcfg); if (xvis==null) { throw new GLException("Error: Choosen FBConfig has no visual"); } } catch (Throwable t) { } return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:caps, caps, null, xvis, fbcfg, fbid); }


chooseGraphicsConfigurationFBConfig

protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilities capabilities,
                                                                                 GLCapabilitiesChooser chooser,
                                                                                 X11GraphicsScreen x11Screen)

chooseGraphicsConfigurationXVisual

protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilities capabilities,
                                                                                GLCapabilitiesChooser chooser,
                                                                                X11GraphicsScreen x11Screen)

toHexString

public static String toHexString(int val)

toHexString

public static String toHexString(long val)


Copyright 2010 JogAmp Community.