javax.media.opengl

## Class GLCapabilities

- java.lang.Object
- - javax.media.nativewindow.Capabilities
  - - javax.media.opengl.GLCapabilities

- All Implemented Interfaces:
    WriteCloneable, Cloneable, Comparable<CapabilitiesImmutable>, CapabilitiesImmutable, VisualIDHolder, GLCapabilitiesImmutable

      public class GLCapabilities
      extends Capabilities
      implements Cloneable, GLCapabilitiesImmutable

  Specifies a set of OpenGL capabilities.
  At creation time of a `GLDrawable` using `GLDrawableFactory`, an instance of this class is passed, describing the desired capabilities that a rendering context must support, such as the OpenGL profile, color depth and whether stereo is enabled.
  The actual capabilites of created `GLDrawable`s are then reflected by their own GLCapabilites instance, which can be queried with `GLDrawable.getChosenGLCapabilities()`.
  It currently contains the minimal number of routines which allow configuration on all supported window systems.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface javax.media.nativewindow.VisualIDHolder

      `VisualIDHolder.VIDComparator, VisualIDHolder.VIDType`

  - ### Field Summary

    - ### Fields inherited from interface javax.media.opengl.GLCapabilitiesImmutable

      `DEFAULT_SAMPLE_EXTENSION`

    - ### Fields inherited from interface javax.media.nativewindow.VisualIDHolder

      `VID_UNDEFINED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GLCapabilities(GLProfile glp)` Creates a GLCapabilities object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `clone()`
    `Object` | `cloneMutable()`
    `int` | `compareTo(CapabilitiesImmutable o)` comparing hw/sw, stereo, multisample, stencil, RGBA and depth only
    `GLCapabilities` | `copyFrom(GLCapabilitiesImmutable source)` Copies all `GLCapabilitiesImmutable` values from `source` into this instance.
    `boolean` | `equals(Object obj)` Equality over the immutable attributes of both objects
    `int` | `getAccumAlphaBits()` Returns the number of bits for the accumulation buffer's alpha component.
    `int` | `getAccumBlueBits()` Returns the number of bits for the accumulation buffer's blue component.
    `int` | `getAccumGreenBits()` Returns the number of bits for the accumulation buffer's green component.
    `int` | `getAccumRedBits()` Returns the number of bits for the accumulation buffer's red component.
    `int` | `getDepthBits()` Returns the number of depth buffer bits.
    `boolean` | `getDoubleBuffered()` Returns whether double-buffering is requested, available or chosen.
    `GLProfile` | `getGLProfile()` Returns the GL profile you desire or used by the drawable.
    `boolean` | `getHardwareAccelerated()` Returns whether hardware acceleration is requested, available or chosen.
    `int` | `getNumSamples()` Returns the number of sample buffers to be allocated if sample buffers are enabled, otherwise returns 0.
    `boolean` | `getSampleBuffers()` Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable.
    `String` | `getSampleExtension()` Returns the extension for full-scene antialiasing (FSAA).
    `int` | `getStencilBits()` Returns the number of stencil buffer bits.
    `boolean` | `getStereo()` Returns whether stereo is requested, available or chosen.
    `int` | `hashCode()` hash code over the immutable attributes of both objects
    `boolean` | `isFBO()` Returns whether FBO offscreen mode is requested, available or chosen.
    `boolean` | `isPBuffer()` Returns whether pbuffer offscreen mode is requested, available or chosen.
    `void` | `setAccumAlphaBits(int accumAlphaBits)` Sets number of bits requested for accumulation buffer's alpha component.
    `void` | `setAccumBlueBits(int accumBlueBits)` Sets the number of bits requested for the accumulation buffer's blue component.
    `void` | `setAccumGreenBits(int accumGreenBits)` Sets the number of bits requested for the accumulation buffer's green component.
    `void` | `setAccumRedBits(int accumRedBits)` Sets the number of bits requested for the accumulation buffer's red component.
    `void` | `setDepthBits(int depthBits)` Sets the number of bits requested for the depth buffer.
    `void` | `setDoubleBuffered(boolean enable)` Enables or disables double buffering.
    `void` | `setFBO(boolean enable)` Requesting offscreen FBO mode.
    `void` | `setGLProfile(GLProfile profile)` Sets the GL profile you desire
    `void` | `setHardwareAccelerated(boolean enable)` Enables or disables hardware acceleration.
    `void` | `setNumSamples(int numSamples)` If sample buffers are enabled, indicates the number of buffers to be allocated.
    `void` | `setPBuffer(boolean enable)` Requesting offscreen pbuffer mode.
    `void` | `setSampleBuffers(boolean enable)` Defaults to false. Indicates whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable. Mind that this requires the alpha component. If enabled this method also invokes `setAlphaBits(1)` if `Capabilities.getAlphaBits()` == 0.
    `void` | `setSampleExtension(String se)` Sets the desired extension for full-scene antialiasing (FSAA), default is `GLCapabilitiesImmutable.DEFAULT_SAMPLE_EXTENSION`.
    `void` | `setStencilBits(int stencilBits)` Sets the number of bits requested for the stencil buffer.
    `void` | `setStereo(boolean enable)` Enables or disables stereo viewing.
    `String` | `toString()` Returns a textual representation of this GLCapabilities object.
    `StringBuilder` | `toString(StringBuilder sink)` Return a textual representation of this object.

    - ### Methods inherited from class javax.media.nativewindow.Capabilities

      `copyFrom, getAlphaBits, getBlueBits, getGreenBits, getRedBits, getTransparentAlphaValue, getTransparentBlueValue, getTransparentGreenValue, getTransparentRedValue, getVisualID, isBackgroundOpaque, isBitmap, isOnscreen, setAlphaBits, setBackgroundOpaque, setBitmap, setBlueBits, setGreenBits, setOnscreen, setRedBits, setTransparentAlphaValue, setTransparentBlueValue, setTransparentGreenValue, setTransparentRedValue`

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

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface javax.media.nativewindow.CapabilitiesImmutable

      `getAlphaBits, getBlueBits, getGreenBits, getRedBits, getTransparentAlphaValue, getTransparentBlueValue, getTransparentGreenValue, getTransparentRedValue, isBackgroundOpaque, isBitmap, isOnscreen`

    - ### Methods inherited from interface javax.media.nativewindow.VisualIDHolder

      `getVisualID`

- - ### Constructor Detail

    - #### GLCapabilities

          public GLCapabilities(GLProfile glp)
                         throws GLException

      Creates a GLCapabilities object. All attributes are in a default state.
      Parameters:
        `glp` - GLProfile, or null for the default GLProfile
      Throws:
        `GLException` - if no profile is given and no default profile is available for the default device.

  - ### Method Detail

    - #### cloneMutable

          public Object cloneMutable()

      Specified by:
        `cloneMutable` in interface `WriteCloneable`
      Overrides:
        `cloneMutable` in class `Capabilities`

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `Capabilities`

    - #### copyFrom

          public GLCapabilities copyFrom(GLCapabilitiesImmutable source)

      Copies all `GLCapabilitiesImmutable` values from `source` into this instance.
      Returns:
        this instance

    - #### hashCode

          public int hashCode()

      Description copied from interface: `CapabilitiesImmutable`
      hash code over the immutable attributes of both objects
      Specified by:
        `hashCode` in interface `CapabilitiesImmutable`
      Specified by:
        `hashCode` in interface `GLCapabilitiesImmutable`
      Overrides:
        `hashCode` in class `Capabilities`

    - #### equals

          public boolean equals(Object obj)

      Description copied from interface: `CapabilitiesImmutable`
      Equality over the immutable attributes of both objects
      Specified by:
        `equals` in interface `CapabilitiesImmutable`
      Specified by:
        `equals` in interface `GLCapabilitiesImmutable`
      Overrides:
        `equals` in class `Capabilities`

    - #### compareTo

          public int compareTo(CapabilitiesImmutable o)

      comparing hw/sw, stereo, multisample, stencil, RGBA and depth only
      Specified by:
        `compareTo` in interface `Comparable<CapabilitiesImmutable>`
      Overrides:
        `compareTo` in class `Capabilities`

    - #### getGLProfile

          public final GLProfile getGLProfile()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the GL profile you desire or used by the drawable.
      Specified by:
        `getGLProfile` in interface `GLCapabilitiesImmutable`

    - #### setGLProfile

          public void setGLProfile(GLProfile profile)

      Sets the GL profile you desire

    - #### isPBuffer

          public final boolean isPBuffer()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether pbuffer offscreen mode is requested, available or chosen.

      Default is false.

      For chosen capabilities, only the selected offscreen surface is set to `true`.

      Specified by:
        `isPBuffer` in interface `GLCapabilitiesImmutable`

    - #### setPBuffer

          public void setPBuffer(boolean enable)

      Requesting offscreen pbuffer mode.

      If enabled this method also invokes `setOnscreen(false)`.

      Defaults to false.

      Requesting offscreen pbuffer mode disables the offscreen auto selection.

    - #### isFBO

          public final boolean isFBO()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether FBO offscreen mode is requested, available or chosen.

      Default is false.

      For chosen capabilities, only the selected offscreen surface is set to `true`.

      Specified by:
        `isFBO` in interface `GLCapabilitiesImmutable`

    - #### setFBO

          public void setFBO(boolean enable)

      Requesting offscreen FBO mode.

      If enabled this method also invokes `setOnscreen(false)`.

      Defaults to false.

      Requesting offscreen FBO mode disables the offscreen auto selection.

    - #### getDoubleBuffered

          public final boolean getDoubleBuffered()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether double-buffering is requested, available or chosen.

      Default is true.

      Specified by:
        `getDoubleBuffered` in interface `GLCapabilitiesImmutable`

    - #### setDoubleBuffered

          public void setDoubleBuffered(boolean enable)

      Enables or disables double buffering.

    - #### getStereo

          public final boolean getStereo()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether stereo is requested, available or chosen.

      Default is false.

      Specified by:
        `getStereo` in interface `GLCapabilitiesImmutable`

    - #### setStereo

          public void setStereo(boolean enable)

      Enables or disables stereo viewing.

    - #### getHardwareAccelerated

          public final boolean getHardwareAccelerated()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether hardware acceleration is requested, available or chosen.

      Default is true.

      Specified by:
        `getHardwareAccelerated` in interface `GLCapabilitiesImmutable`

    - #### setHardwareAccelerated

          public void setHardwareAccelerated(boolean enable)

      Enables or disables hardware acceleration.

    - #### getDepthBits

          public final int getDepthBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of depth buffer bits.
      Specified by:
        `getDepthBits` in interface `GLCapabilitiesImmutable`

    - #### setDepthBits

          public void setDepthBits(int depthBits)

      Sets the number of bits requested for the depth buffer.

    - #### getStencilBits

          public final int getStencilBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of stencil buffer bits.

      Default is 0.

      Specified by:
        `getStencilBits` in interface `GLCapabilitiesImmutable`

    - #### setStencilBits

          public void setStencilBits(int stencilBits)

      Sets the number of bits requested for the stencil buffer.

    - #### getAccumRedBits

          public final int getAccumRedBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of bits for the accumulation buffer's red component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.
      Specified by:
        `getAccumRedBits` in interface `GLCapabilitiesImmutable`

    - #### setAccumRedBits

          public void setAccumRedBits(int accumRedBits)

      Sets the number of bits requested for the accumulation buffer's red component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.

    - #### getAccumGreenBits

          public final int getAccumGreenBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of bits for the accumulation buffer's green component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.
      Specified by:
        `getAccumGreenBits` in interface `GLCapabilitiesImmutable`

    - #### setAccumGreenBits

          public void setAccumGreenBits(int accumGreenBits)

      Sets the number of bits requested for the accumulation buffer's green component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.

    - #### getAccumBlueBits

          public final int getAccumBlueBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of bits for the accumulation buffer's blue component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.
      Specified by:
        `getAccumBlueBits` in interface `GLCapabilitiesImmutable`

    - #### setAccumBlueBits

          public void setAccumBlueBits(int accumBlueBits)

      Sets the number of bits requested for the accumulation buffer's blue component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.

    - #### getAccumAlphaBits

          public final int getAccumAlphaBits()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of bits for the accumulation buffer's alpha component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.
      Specified by:
        `getAccumAlphaBits` in interface `GLCapabilitiesImmutable`

    - #### setAccumAlphaBits

          public void setAccumAlphaBits(int accumAlphaBits)

      Sets number of bits requested for accumulation buffer's alpha component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered.

    - #### setSampleExtension

          public void setSampleExtension(String se)

      Sets the desired extension for full-scene antialiasing (FSAA), default is `GLCapabilitiesImmutable.DEFAULT_SAMPLE_EXTENSION`.

    - #### getSampleExtension

          public final String getSampleExtension()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the extension for full-scene antialiasing (FSAA).

      Default is `GLCapabilitiesImmutable.DEFAULT_SAMPLE_EXTENSION`.

      Specified by:
        `getSampleExtension` in interface `GLCapabilitiesImmutable`

    - #### setSampleBuffers

          public void setSampleBuffers(boolean enable)

      Defaults to false.
      Indicates whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable.
      Mind that this requires the alpha component.
      If enabled this method also invokes `setAlphaBits(1)` if `Capabilities.getAlphaBits()` == 0.

    - #### getSampleBuffers

          public final boolean getSampleBuffers()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable.

      Default is false.

      Specified by:
        `getSampleBuffers` in interface `GLCapabilitiesImmutable`

    - #### setNumSamples

          public void setNumSamples(int numSamples)

      If sample buffers are enabled, indicates the number of buffers to be allocated. Defaults to 2.
      See Also:
        `getNumSamples()`

    - #### getNumSamples

          public final int getNumSamples()

      Description copied from interface: `GLCapabilitiesImmutable`
      Returns the number of sample buffers to be allocated if sample buffers are enabled, otherwise returns 0.

      Default is 0 due to disable sample buffers per default.

      Specified by:
        `getNumSamples` in interface `GLCapabilitiesImmutable`

    - #### toString

          public StringBuilder toString(StringBuilder sink)

      Description copied from interface: `CapabilitiesImmutable`
      Return a textual representation of this object. Use the given StringBuilder [optional].
      Specified by:
        `toString` in interface `CapabilitiesImmutable`
      Overrides:
        `toString` in class `Capabilities`

    - #### toString

          public String toString()

      Returns a textual representation of this GLCapabilities object.
      Specified by:
        `toString` in interface `CapabilitiesImmutable`
      Specified by:
        `toString` in interface `GLCapabilitiesImmutable`
      Overrides:
        `toString` in class `Capabilities`

Copyright 2010 JogAmp Community.