javax.media.opengl
Class GLCapabilities

java.lang.Object
  extended by javax.media.nativewindow.Capabilities
      extended by javax.media.opengl.GLCapabilities
All Implemented Interfaces:
WriteCloneable, Cloneable, Comparable, CapabilitiesImmutable, 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 GLDrawables are then reflected by their own GLCapabilites instance, which can be queried with GLDrawable#getGLCapabilities().
It currently contains the minimal number of routines which allow configuration on all supported window systems.


Constructor Summary
GLCapabilities(GLProfile glp)
          Creates a GLCapabilities object.
 
Method Summary
 Object clone()
           
 Object cloneMutable()
           
 int compareTo(Object o)
          comparing hw/sw, stereo, multisample, stencil, RGBA and depth only
 boolean equals(Object obj)
           
 int getAccumAlphaBits()
          Returns the number of bits requested for the accumulation buffer's alpha component.
 int getAccumBlueBits()
          Returns the number of bits requested for the accumulation buffer's blue component.
 int getAccumGreenBits()
          Returns the number of bits requested for the accumulation buffer's green component.
 int getAccumRedBits()
          Returns the number of bits requested for the accumulation buffer's red component.
 int getDepthBits()
          Returns the number of bits requested for the depth buffer.
 boolean getDoubleBuffered()
          Indicates whether double-buffering is enabled.
 GLProfile getGLProfile()
          Returns the GL profile you desire or used by the drawable.
 boolean getHardwareAccelerated()
          Indicates whether hardware acceleration is enabled.
 int getNumSamples()
          Returns the number of sample buffers to be allocated if sample buffers are enabled.
 boolean getPbufferFloatingPointBuffers()
          For pbuffers only, returns whether floating-point buffers should be used if available.
 boolean getPbufferRenderToTexture()
          For pbuffers only, returns whether the render-to-texture extension should be used if available.
 boolean getPbufferRenderToTextureRectangle()
          For pbuffers only, returns whether the render-to-texture extension should be used.
 boolean getSampleBuffers()
          Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable.
 int getStencilBits()
          Returns the number of bits requested for the stencil buffer.
 boolean getStereo()
          Indicates whether stereo is enabled.
 int hashCode()
           
 boolean isPBuffer()
          Indicates whether pbuffer is used/requested.
 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 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 setOnscreen(boolean onscreen)
          Sets whether the drawable surface supports onscreen.
If enabled this method also invokes setPBuffer(false)
Defaults to true.
 void setPBuffer(boolean enable)
          Enables or disables pbuffer usage.
If enabled this method also invokes setOnscreen(false)
Defaults to false.
 void setPbufferFloatingPointBuffers(boolean enable)
          For pbuffers only, indicates whether floating-point buffers should be used if available.
 void setPbufferRenderToTexture(boolean enable)
          For pbuffers only, indicates whether the render-to-texture extension should be used if available.
 void setPbufferRenderToTextureRectangle(boolean enable)
          For pbuffers only, indicates whether the render-to-texture-rectangle extension should be used if available.
 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 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.
 StringBuffer toString(StringBuffer sink)
           
 
Methods inherited from class javax.media.nativewindow.Capabilities
getAlphaBits, getBlueBits, getGreenBits, getRedBits, getTransparentAlphaValue, getTransparentBlueValue, getTransparentGreenValue, getTransparentRedValue, isBackgroundOpaque, isOnscreen, setAlphaBits, setBackgroundOpaque, setBlueBits, setGreenBits, 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, isOnscreen
 

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

hashCode

public int hashCode()
Specified by:
hashCode in interface CapabilitiesImmutable
Specified by:
hashCode in interface GLCapabilitiesImmutable
Overrides:
hashCode in class Capabilities

equals

public boolean equals(Object obj)
Specified by:
equals in interface CapabilitiesImmutable
Specified by:
equals in interface GLCapabilitiesImmutable
Overrides:
equals in class Capabilities

compareTo

public int compareTo(Object o)
comparing hw/sw, stereo, multisample, stencil, RGBA and depth only

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Capabilities

getGLProfile

public GLProfile getGLProfile()
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 boolean isPBuffer()
Indicates whether pbuffer is used/requested.

Specified by:
isPBuffer in interface GLCapabilitiesImmutable

setPBuffer

public void setPBuffer(boolean enable)
Enables or disables pbuffer usage.
If enabled this method also invokes setOnscreen(false)
Defaults to false.


setOnscreen

public void setOnscreen(boolean onscreen)
Sets whether the drawable surface supports onscreen.
If enabled this method also invokes setPBuffer(false)
Defaults to true.

Overrides:
setOnscreen in class Capabilities

getDoubleBuffered

public boolean getDoubleBuffered()
Indicates whether double-buffering is enabled.

Specified by:
getDoubleBuffered in interface GLCapabilitiesImmutable

setDoubleBuffered

public void setDoubleBuffered(boolean enable)
Enables or disables double buffering.


getStereo

public boolean getStereo()
Indicates whether stereo is enabled.

Specified by:
getStereo in interface GLCapabilitiesImmutable

setStereo

public void setStereo(boolean enable)
Enables or disables stereo viewing.


getHardwareAccelerated

public boolean getHardwareAccelerated()
Indicates whether hardware acceleration is enabled.

Specified by:
getHardwareAccelerated in interface GLCapabilitiesImmutable

setHardwareAccelerated

public void setHardwareAccelerated(boolean enable)
Enables or disables hardware acceleration.


getDepthBits

public int getDepthBits()
Returns the number of bits requested for the depth buffer.

Specified by:
getDepthBits in interface GLCapabilitiesImmutable

setDepthBits

public void setDepthBits(int depthBits)
Sets the number of bits requested for the depth buffer.


getStencilBits

public int getStencilBits()
Returns the number of bits requested for the stencil buffer.

Specified by:
getStencilBits in interface GLCapabilitiesImmutable

setStencilBits

public void setStencilBits(int stencilBits)
Sets the number of bits requested for the stencil buffer.


getAccumRedBits

public int getAccumRedBits()
Returns 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.

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 int getAccumGreenBits()
Returns 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.

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 int getAccumBlueBits()
Returns 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.

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 int getAccumAlphaBits()
Returns the number of bits requested 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.


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 boolean getSampleBuffers()
Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawable. Defaults to 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.


getNumSamples

public int getNumSamples()
Returns the number of sample buffers to be allocated if sample buffers are enabled. Defaults to 2.

Specified by:
getNumSamples in interface GLCapabilitiesImmutable

setPbufferFloatingPointBuffers

public void setPbufferFloatingPointBuffers(boolean enable)
For pbuffers only, indicates whether floating-point buffers should be used if available. Defaults to false.


getPbufferFloatingPointBuffers

public boolean getPbufferFloatingPointBuffers()
For pbuffers only, returns whether floating-point buffers should be used if available. Defaults to false.

Specified by:
getPbufferFloatingPointBuffers in interface GLCapabilitiesImmutable

setPbufferRenderToTexture

public void setPbufferRenderToTexture(boolean enable)
For pbuffers only, indicates whether the render-to-texture extension should be used if available. Defaults to false.


getPbufferRenderToTexture

public boolean getPbufferRenderToTexture()
For pbuffers only, returns whether the render-to-texture extension should be used if available. Defaults to false.

Specified by:
getPbufferRenderToTexture in interface GLCapabilitiesImmutable

setPbufferRenderToTextureRectangle

public void setPbufferRenderToTextureRectangle(boolean enable)
For pbuffers only, indicates whether the render-to-texture-rectangle extension should be used if available. Defaults to false.


getPbufferRenderToTextureRectangle

public boolean getPbufferRenderToTextureRectangle()
For pbuffers only, returns whether the render-to-texture extension should be used. Defaults to false.

Specified by:
getPbufferRenderToTextureRectangle in interface GLCapabilitiesImmutable

toString

public StringBuffer toString(StringBuffer sink)
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.