NASA World Wind

gov.nasa.worldwind.render
Class GLRuntimeCapabilities

java.lang.Object
  extended by gov.nasa.worldwind.render.GLRuntimeCapabilities

public class GLRuntimeCapabilities
extends Object

GLRuntimeCapabilities describes the GL capabilities supported by the current GL runtime. It provides the caller with the current GL version, with information about which GL features are available, and with properties defining the capabilities of those features.

For each GL feature, there are three key pieces of information available through GLRuntimeCapabilities:

GLRuntimeCapabilities is designed to automatically configure itself with information about the current GL runtime. To invoke this behavior, call initialize(javax.media.opengl.GLContext) with a valid GLContext at the beginning of each rendering pass.


Field Summary
protected  int depthBits
           
protected static String GL_EXT_FRAMEBUFFER_OBJECT_STRING
           
protected static String GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING
           
protected  double glVersion
           
protected  boolean isAnisotropicTextureFilterAvailable
           
protected  boolean isAnisotropicTextureFilterEnabled
           
protected  boolean isFramebufferObjectAvailable
           
protected  boolean isFramebufferObjectEnabled
           
protected  boolean isVertexBufferObjectAvailable
           
protected  boolean isVertexBufferObjectEnabled
           
protected  boolean isVMwareSVGA3D
           
protected  double maxTextureAnisotropy
           
protected  int maxTextureSize
           
protected  int numTextureUnits
           
 
Constructor Summary
GLRuntimeCapabilities()
          Constructs a new GLAtttributes, enabling framebuffer objects, anisotropic texture filtering, and vertex buffer objects.
 
Method Summary
 int getDepthBits()
          Returns the number of bitplanes in the current GL depth buffer.
 double getGLVersion()
          Returns the current GL runtime version as a real number.
 double getMaxTextureAnisotropy()
          Returns a real number defining the maximum degree of texture anisotropy supported by the current GL runtime.
 int getMaxTextureSize()
          Returns the maximum texture size in texels supported by the current GL runtime.
 int getNumTextureUnits()
          Returns the number of texture units supported by the current GL runtime.
 void initialize(GLContext glContext)
          Initialize this GLRuntimeCapabilities from the specified GLContext.
 boolean isAnisotropicTextureFilterAvailable()
          Returns true if anisotropic filtering is available in the current GL runtime.
 boolean isAnisotropicTextureFilterEnabled()
          Returns true if anisotropic texture filtering is enabled for use (only applicable if the feature is available in the current GL runtime)
 boolean isFramebufferObjectAvailable()
          Returns true if framebuffer objects are available in the current GL runtime.
 boolean isFramebufferObjectEnabled()
          Returns true if framebuffer objects are enabled for use (only applicable if the feature is available in the current GL runtime)
 boolean isUseAnisotropicTextureFilter()
          Returns true if anisotropic texture filtering is available in the current GL runtime, and is enabled.
 boolean isUseFramebufferObject()
          Returns true if framebuffer objects are available in the current GL runtime, and are enabled.
 boolean isUseVertexBufferObject()
          Returns true if vertex buffer objects are available in the current GL runtime, and are enabled.
 boolean isVertexBufferObjectAvailable()
          Returns true if vertex buffer objects are available in the current GL runtime.
 boolean isVertexBufferObjectEnabled()
          Returns true if anisotropic vertex buffer objects are enabled for use (only applicable if the feature is available in the current GL runtime).
 boolean isVMwareSVGA3D()
          Returns true if the OpenGL implementation is provided by the VMware SVGA 3D driver.
 void setAnisotropicTextureFilterAvailable(boolean available)
          Sets whether or not anisotropic filtering is available in the current GL runtime.
 void setAnisotropicTextureFilterEnabled(boolean enable)
          Sets whether or not anisotropic texture filtering should be used if it is available in the current GL runtime.
 void setDepthBits(int depthBits)
          Sets the number of bitplanes in the current GL depth buffer.
 void setFramebufferObjectAvailable(boolean available)
          Sets whether or not framebuffer objects are available in the current GL runtime.
 void setFramebufferObjectEnabled(boolean enable)
          Sets whether or not framebuffer objects should be used if they are available in the current GL runtime.
 void setGLVersion(double version)
          Sets the current GL runtime version as a real number.
 void setMaxTextureAnisotropy(double maxAnisotropy)
          Sets the maximum degree of texture anisotropy supported by the current GL runtime.
 void setMaxTextureSize(int maxTextureSize)
          Sets the maximum texture size in texels supported by the current GL runtime.
 void setNumTextureUnits(int numTextureUnits)
          Sets the number of texture units supported by the current GL runtime.
 void setVertexBufferObjectAvailable(boolean available)
          Sets whether or not vertext buffer objects are available in the current GL runtime.
 void setVertexBufferObjectEnabled(boolean enable)
          Sets whether or not vertex buffer objects should be used if they are available in the current GL runtime.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

depthBits

protected int depthBits

GL_EXT_FRAMEBUFFER_OBJECT_STRING

protected static final String GL_EXT_FRAMEBUFFER_OBJECT_STRING
See Also:
Constant Field Values

GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING

protected static final String GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING
See Also:
Constant Field Values

glVersion

protected double glVersion

isAnisotropicTextureFilterAvailable

protected boolean isAnisotropicTextureFilterAvailable

isAnisotropicTextureFilterEnabled

protected boolean isAnisotropicTextureFilterEnabled

isFramebufferObjectAvailable

protected boolean isFramebufferObjectAvailable

isFramebufferObjectEnabled

protected boolean isFramebufferObjectEnabled

isVertexBufferObjectAvailable

protected boolean isVertexBufferObjectAvailable

isVertexBufferObjectEnabled

protected boolean isVertexBufferObjectEnabled

isVMwareSVGA3D

protected boolean isVMwareSVGA3D

maxTextureAnisotropy

protected double maxTextureAnisotropy

maxTextureSize

protected int maxTextureSize

numTextureUnits

protected int numTextureUnits
Constructor Detail

GLRuntimeCapabilities

public GLRuntimeCapabilities()
Constructs a new GLAtttributes, enabling framebuffer objects, anisotropic texture filtering, and vertex buffer objects. Note that these properties are marked as enabled, but they are not known to be available yet. All other properties are set to default values which may be set explicitly by the caller, or implicitly by calling initialize(javax.media.opengl.GLContext).

Note: The default vertex-buffer usage flag can be set via Configuration using the key "gov.nasa.worldwind.avkey.VBOUsage". If that key is not specified in the configuration then vertex-buffer usage defaults to true.

Method Detail

getDepthBits

public int getDepthBits()
Returns the number of bitplanes in the current GL depth buffer. The number of bitplanes is directly proportional to the accuracy of the GL renderer's hidden surface removal. The returned value is typically 16, 24 or 32. For more information on OpenGL depth buffering, see http://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm.

Returns:
the number of bitplanes in the current GL depth buffer.

getGLVersion

public double getGLVersion()
Returns the current GL runtime version as a real number. For example, if the GL version is 1.5, this returns the floating point number equivalent to 1.5.

Returns:
GL version as a number.

getMaxTextureAnisotropy

public double getMaxTextureAnisotropy()
Returns a real number defining the maximum degree of texture anisotropy supported by the current GL runtime. This defines the maximum ratio of the anisotropic texture filter. So 2.0 would define a maximum ratio of 2:1. If the degree is less than 2, then the anisotropic texture filter is not supported by the current GL runtime.

Returns:
the maximum degree of texture anisotropy supported.

getMaxTextureSize

public int getMaxTextureSize()
Returns the maximum texture size in texels supported by the current GL runtime. For a 1D texture, this defines the maximum texture width, for a 2D texture, this defines the maximum texture width and height, and for a 3D texture, this defines the maximum width, height, and depth.

Returns:
the maximum texture size supported, in texels.

getNumTextureUnits

public int getNumTextureUnits()
Returns the number of texture units supported by the current GL runtime.

Returns:
the number of texture units supported.

initialize

public void initialize(GLContext glContext)
Initialize this GLRuntimeCapabilities from the specified GLContext. The context's runtime GL capabilities are examined, and the properties of this GLRuntimeCapabilities are modified accordingly. Invoking initialize() may change any property of this GLRuntimeCapabilities, except the caller specified enable flags: is[Feature]Enabled.

Parameters:
glContext - the GLContext from which to initialize GL runtime capabilities.
Throws:
IllegalArgumentException - if the glContext is null.

isAnisotropicTextureFilterAvailable

public boolean isAnisotropicTextureFilterAvailable()
Returns true if anisotropic filtering is available in the current GL runtime.

Returns:
true if anisotropic texture filtering is available, and false otherwise.

isAnisotropicTextureFilterEnabled

public boolean isAnisotropicTextureFilterEnabled()
Returns true if anisotropic texture filtering is enabled for use (only applicable if the feature is available in the current GL runtime)

Returns:
true if anisotropic texture filtering is enabled, and false otherwise.

isFramebufferObjectAvailable

public boolean isFramebufferObjectAvailable()
Returns true if framebuffer objects are available in the current GL runtime.

Returns:
true if framebuffer objects are available, and false otherwise.

isFramebufferObjectEnabled

public boolean isFramebufferObjectEnabled()
Returns true if framebuffer objects are enabled for use (only applicable if the feature is available in the current GL runtime)

Returns:
true if framebuffer objects are enabled, and false otherwise.

isUseAnisotropicTextureFilter

public boolean isUseAnisotropicTextureFilter()
Returns true if anisotropic texture filtering is available in the current GL runtime, and is enabled. Otherwise this returns false. For details on GL anisotropic texture filtering, see http://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt.

Returns:
true if anisotropic texture filtering is available and enabled, and false otherwise.

isUseFramebufferObject

public boolean isUseFramebufferObject()
Returns true if framebuffer objects are available in the current GL runtime, and are enabled. Otherwise this returns false. For details on GL framebuffer objects, see http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt.

Returns:
true if framebuffer objects are available and enabled, and false otherwise.

isUseVertexBufferObject

public boolean isUseVertexBufferObject()
Returns true if vertex buffer objects are available in the current GL runtime, and are enabled. Otherwise this returns false. For details on GL vertex buffer objects, see http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt.

Returns:
true if vertex buffer objects are available and enabled, and false otherwise.

isVertexBufferObjectAvailable

public boolean isVertexBufferObjectAvailable()
Returns true if vertex buffer objects are available in the current GL runtime.

Returns:
true if vertex buffer objects are available, and false otherwise.

isVertexBufferObjectEnabled

public boolean isVertexBufferObjectEnabled()
Returns true if anisotropic vertex buffer objects are enabled for use (only applicable if the feature is available in the current GL runtime).

Returns:
true if anisotropic vertex buffer objects are, and false otherwise.

isVMwareSVGA3D

public boolean isVMwareSVGA3D()
Returns true if the OpenGL implementation is provided by the VMware SVGA 3D driver. Otherwise this returns false.

This flag is used to work around bugs and unusual behavior in the VMware SVGA 3D driver. For details on VMware graphics drivers, see http://www.vmware.com/files/pdf/techpaper/vmware-horizon-view-graphics-acceleration-deployment.pdf.

Returns:
true if the OpenGL implementation is VMware SVGA 3D, and false otherwise.

setAnisotropicTextureFilterAvailable

public void setAnisotropicTextureFilterAvailable(boolean available)
Sets whether or not anisotropic filtering is available in the current GL runtime.

Parameters:
available - true to flag anisotropic texture filtering as available, and false otherwise.

setAnisotropicTextureFilterEnabled

public void setAnisotropicTextureFilterEnabled(boolean enable)
Sets whether or not anisotropic texture filtering should be used if it is available in the current GL runtime.

Parameters:
enable - true to enable anisotropic texture filtering, false to disable it.

setDepthBits

public void setDepthBits(int depthBits)
Sets the number of bitplanes in the current GL depth buffer. The specified value is typically 16, 24 or 32.

Parameters:
depthBits - the number of bitplanes in the current GL depth buffer.
Throws:
IllegalArgumentException - if depthBits is less than one.

setFramebufferObjectAvailable

public void setFramebufferObjectAvailable(boolean available)
Sets whether or not framebuffer objects are available in the current GL runtime.

Parameters:
available - true to flag framebuffer objects as available, and false otherwise.

setFramebufferObjectEnabled

public void setFramebufferObjectEnabled(boolean enable)
Sets whether or not framebuffer objects should be used if they are available in the current GL runtime.

Parameters:
enable - true to enable framebuffer objects, false to disable them.

setGLVersion

public void setGLVersion(double version)
Sets the current GL runtime version as a real number. For example, to set a GL version of 1.5, specify the floating point number 1.5.

Parameters:
version - the GL version as a number.

setMaxTextureAnisotropy

public void setMaxTextureAnisotropy(double maxAnisotropy)
Sets the maximum degree of texture anisotropy supported by the current GL runtime. This value defines the maximum ratio of the an anisotropic texture filter. So 2.0 would define a maximum ratio of 2:1. A valueless than 2 denotes that the anisotropic texture filter is not supported by the current GL runtime.

Parameters:
maxAnisotropy - the maximum degree of texture anisotropy supported.

setMaxTextureSize

public void setMaxTextureSize(int maxTextureSize)
Sets the maximum texture size in texels supported by the current GL runtime. For a 1D texture, this defines the maximum texture width, for a 2D texture, this defines the maximum texture width and height, and for a 3D texture, this defines the maximum width, height, and depth.

Parameters:
maxTextureSize - the maximum texture size supported, in texels.
Throws:
IllegalArgumentException - if the size is less than one.

setNumTextureUnits

public void setNumTextureUnits(int numTextureUnits)
Sets the number of texture units supported by the current GL runtime.

Parameters:
numTextureUnits - the number texture units supported.
Throws:
IllegalArgumentException - if the number of texture units is less than one.

setVertexBufferObjectAvailable

public void setVertexBufferObjectAvailable(boolean available)
Sets whether or not vertext buffer objects are available in the current GL runtime.

Parameters:
available - true to flag vertex buffer objects as available, and false otherwise.

setVertexBufferObjectEnabled

public void setVertexBufferObjectEnabled(boolean enable)
Sets whether or not vertex buffer objects should be used if they are available in the current GL runtime.

Parameters:
enable - true to enable vertex buffer objects, false to disable them.

NASA World Wind