javax.media.opengl

## Class DefaultGLCapabilitiesChooser

- java.lang.Object
- - javax.media.opengl.DefaultGLCapabilitiesChooser

- All Implemented Interfaces:
    CapabilitiesChooser, GLCapabilitiesChooser

      public class DefaultGLCapabilitiesChooser
      extends Object
      implements GLCapabilitiesChooser

  The default implementation of the `GLCapabilitiesChooser` interface, which provides consistent visual selection behavior across platforms. The precise algorithm is deliberately left loosely specified. Some properties are:

  - As long as there is at least one available non-null GLCapabilities which matches the "stereo" option, will return a valid index.
  - Attempts to match as closely as possible the given GLCapabilities, but will select one with fewer capabilities (i.e., lower color depth) if necessary.
  - Prefers hardware-accelerated visuals to non-hardware-accelerated.
  - If there is no exact match, prefers a more-capable visual to a less-capable one.
  - If there is more than one exact match, chooses an arbitrary one.
  - May select the opposite of a double- or single-buffered visual (based on the user's request) in dire situations.
  - Color depth (including alpha) mismatches are weighted higher than depth buffer mismatches, which are in turn weighted higher than accumulation buffer (including alpha) and stencil buffer depth mismatches.
  - If a valid windowSystemRecommendedChoice parameter is supplied, chooses that instead of using the cross-platform code.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultGLCapabilitiesChooser()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `chooseCapabilities(CapabilitiesImmutable desired, List<? extends CapabilitiesImmutable> available, int windowSystemRecommendedChoice)` Chooses the index (0..available.length - 1) of the `Capabilities` most closely matching the desired one from the list of all supported.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultGLCapabilitiesChooser

          public DefaultGLCapabilitiesChooser()

  - ### Method Detail

    - #### chooseCapabilities

          public int chooseCapabilities(CapabilitiesImmutable desired,
                               List<? extends CapabilitiesImmutable> available,
                               int windowSystemRecommendedChoice)

      Description copied from interface: `javax.media.nativewindow.CapabilitiesChooser`
      Chooses the index (0..available.length - 1) of the `Capabilities` most closely matching the desired one from the list of all supported. Some of the entries in the `available` array may be null; the chooser must ignore these. The windowSystemRecommendedChoice parameter may be provided to the chooser by the underlying window system; if this index is valid, it is recommended, but not necessarily required, that the chooser select that entry.

      Note: this method is called automatically by the `GraphicsConfigurationFactory.chooseGraphicsConfiguration(javax.media.nativewindow.CapabilitiesImmutable, javax.media.nativewindow.CapabilitiesImmutable, javax.media.nativewindow.CapabilitiesChooser, javax.media.nativewindow.AbstractGraphicsScreen, int)` method when an instance of this class is passed in to it. It should generally not be invoked by users directly, unless it is desired to delegate the choice to some other CapabilitiesChooser object.

      Specified by:
        `chooseCapabilities` in interface `CapabilitiesChooser`

Copyright 2010 JogAmp Community.