Class GLRuntimeCapabilities
- java.lang.Object
-
- gov.nasa.worldwind.render.GLRuntimeCapabilities
-
public class GLRuntimeCapabilities extends java.lang.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:
- The
property
is[Feature]Available
defines whether or not the feature is supported by the current GL runtime. This is an attribute of the GL runtime, and is typically configured automatically by a call toinitialize(com.jogamp.opengl.GLContext)
. - The property
is[Feature]Enabled
defines whether or not this feature should be used, and must be configured by the caller. - The convenience method
isUse[Feature]()
. This returns whether or not the feature is available and is enabled for use (it is simply a conjunction of the "available" and "enabled" properties).
GLRuntimeCapabilities is designed to automatically configure itself with information about the current GL runtime. To invoke this behavior, call
initialize(com.jogamp.opengl.GLContext)
with a valid GLContext at the beginning of each rendering pass. - The
property
-
-
Field Summary
Fields Modifier and Type Field Description protected int
depthBits
protected static java.lang.String
GL_EXT_FRAMEBUFFER_OBJECT_STRING
protected static java.lang.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
Constructors Constructor Description GLRuntimeCapabilities()
Constructs a new GLAtttributes, enabling framebuffer objects, anisotropic texture filtering, and vertex buffer objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(com.jogamp.opengl.GLContext glContext)
Initialize this GLRuntimeCapabilities from the specifiedGLContext
.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.
-
-
-
Field Detail
-
GL_EXT_FRAMEBUFFER_OBJECT_STRING
protected static final java.lang.String GL_EXT_FRAMEBUFFER_OBJECT_STRING
- See Also:
- Constant Field Values
-
GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING
protected static final java.lang.String GL_EXT_TEXTURE_FILTER_ANISOTROPIC_STRING
- See Also:
- Constant Field Values
-
glVersion
protected double glVersion
-
isVMwareSVGA3D
protected boolean isVMwareSVGA3D
-
isAnisotropicTextureFilterAvailable
protected boolean isAnisotropicTextureFilterAvailable
-
isAnisotropicTextureFilterEnabled
protected boolean isAnisotropicTextureFilterEnabled
-
isFramebufferObjectAvailable
protected boolean isFramebufferObjectAvailable
-
isFramebufferObjectEnabled
protected boolean isFramebufferObjectEnabled
-
isVertexBufferObjectAvailable
protected boolean isVertexBufferObjectAvailable
-
isVertexBufferObjectEnabled
protected boolean isVertexBufferObjectEnabled
-
depthBits
protected int depthBits
-
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 callinginitialize(com.jogamp.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 totrue
.
-
-
Method Detail
-
initialize
public void initialize(com.jogamp.opengl.GLContext glContext)
Initialize this GLRuntimeCapabilities from the specifiedGLContext
. 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:
java.lang.IllegalArgumentException
- if the glContext is null.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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:
java.lang.IllegalArgumentException
- if depthBits is less than one.
-
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.
-
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.
-
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.
-
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:
java.lang.IllegalArgumentException
- if the size is less than one.
-
getNumTextureUnits
public int getNumTextureUnits()
Returns the number of texture units supported by the current GL runtime.- Returns:
- the number of texture units supported.
-
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:
java.lang.IllegalArgumentException
- if the number of texture units is less than one.
-
-