Class SoTexture
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoTexture
-
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SoExtTexture2
,SoIndexedTexture2
,SoTexture2
,SoTexture3
,SoTextureCubeMap
public abstract class SoTexture extends SoNode
Abstract base class for texture mapping nodes. This is the abstract base class for all texture image nodes. It defines the common methods and fields that all texture image nodes have. When a texture image node is encountered during traversal, the associated image and parameters are applied to the current texture unit (seeSoTextureUnit
) and used to apply the texture to subsequent shapes.Open Inventor provides multiple texture image nodes optimized for different purposes, including:
SoTexture2
The basic 2D texture image node. The image may be loaded from a file, loaded from an image in memory or created by rendering a scene graph.SoExtTexture2
This node is similar toSoTexture2
, but has specific optimizations that are valuable for applications that load a large number of textures from files.SoIndexedTexture2
The first two nodes load an image containing color values that are directly applied to the geometry. This node considers each texel to be a data value that is mapped to a color using the color map defined by anSoColorMap
node. This is very useful for "intensity" data sets.SoTextureCubeMap
This node loads a set of six images representing the faces of a cube. These are "shrink wrapped" onto the geometry similar to environment mapping, but without the need for a single specially warped environment image.SoTexture3
This node defines a 3D texture map. The image may be loaded from a set of files or loaded directly from memory. A 3D texture may be used to load a volume data set, but note that the Open Inventor VolumeViz nodes are specifically implemented for this purpose (seeSoVolumeData
).
Applications may use the
isSupported()
method to check if the graphics hardware supports a specific texture mapping feature.File format/default:
This is an abstract class. See the reference page of a derived class for the format and default values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoTexture.FileTypes
File Type possible values.static class
SoTexture.Filters
Specifies the OpenGL filtering method for minification and magnification.static class
SoTexture.HW_Features
static class
SoTexture.InternalFormats
Texture internal storage format.static class
SoTexture.Models
Texture Combiner Functions.static class
SoTexture.WrapType
Texture wrap type.-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFColor
blendColor
Color used for BLEND model.SoSFVec4f
borderColor
Defines border color used for border texture filtering.SoSFBool
enableBorder
Enables borders for textures.SoSFBool
enableCompressedTexture
Enables storage of textures on the graphics board in compressed form.SoSFEnum<SoTexture.InternalFormats>
internalFormat
Internal format for texture storage.SoSFEnum<SoTexture.Filters>
magFilter
Specifies the OpenGL magFilter.SoSFFloat
maxAnisotropy
Specifies on a per-texture object basis, the maximum degree of anisotropy to account for in texture filtering.SoSFEnum<SoTexture.Filters>
minFilter
Specifies the OpenGL minFilter.SoSFEnum<SoTexture.Models>
model
Specifies how to map texture onto surface.SoSFEnum<SoTexture.WrapType>
wrapS
Indicates what to do when texture coordinates in the S (horizontal) direction lie outside the range 0-1.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SoTexture.FileTypes
getBitmapFileType()
Gets the texture file format.static boolean
isSupported(SoTexture.HW_Features feature)
Returns information about hardware support for various texture features.static SbRasterImage
readTexture(java.lang.String filename)
Calls readTexture(filename, SoTexture.FileTypes.valueOf( SoTexture.FileTypes.UNKNOWN.getValue() )).static SbRasterImage
readTexture(java.lang.String filename, SoTexture.FileTypes filetype)
Convenience function that loads the image data from any texture file supported by Open Inventor and returns anSbRasterImage
object.void
setBitmapFileType(SoTexture.FileTypes in_type)
Sets the texture file format.-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
internalFormat
public final SoSFEnum<SoTexture.InternalFormats> internalFormat
Internal format for texture storage. If not available on the graphics device, internalFormat is set back to AUTO_INTERNAL_FORMAT. Use enumInternalFormat
. Default is AUTO_INTERNAL_FORMAT. If internal format is set to AUTO_INTERNAL_FORMAT texture precision could only be 16-bit maximum. To go beyond this limitation, you must set the internal format to the needed value.- Since:
- Open Inventor 6.0
-
enableCompressedTexture
public final SoSFBool enableCompressedTexture
Enables storage of textures on the graphics board in compressed form. The application supplies textures as usual, then OpenGL compresses the textures. This can reduce usage of texture memory significantly, depending on the texture image.
To use this option, you must be using OpenGL 1.3 or higher, or your board must support the OpenGL GL_ARB_texture_compression extension.
- Since:
- Open Inventor 4.0
-
wrapS
public final SoSFEnum<SoTexture.WrapType> wrapS
Indicates what to do when texture coordinates in the S (horizontal) direction lie outside the range 0-1. Use enumWrap
. Default is REPEAT.
-
model
public final SoSFEnum<SoTexture.Models> model
Specifies how to map texture onto surface. Use enumModel
. Default is MODULATE.
-
blendColor
public final SoSFColor blendColor
Color used for BLEND model.
-
enableBorder
public final SoSFBool enableBorder
Enables borders for textures. This means that the border is already in the texture.- Since:
- Open Inventor 5.0
-
borderColor
public final SoSFVec4f borderColor
Defines border color used for border texture filtering. This value is only used ifenableBorder
is false.- Since:
- Open Inventor 5.0
-
maxAnisotropy
public final SoSFFloat maxAnisotropy
Specifies on a per-texture object basis, the maximum degree of anisotropy to account for in texture filtering. If the specified value is greater than the maximum supported by the graphics board, the value is clamped to GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT.
To use this option, you must be using OpenGL 1.1 or higher, or your board must support the OpenGL GL_EXT_filter_anisotropic extension.
- Since:
- Open Inventor 5.0
-
minFilter
public final SoSFEnum<SoTexture.Filters> minFilter
Specifies the OpenGL minFilter. Use enumFilter
. Default is AUTO. The minification filter is used when the rendered size of the geometry is smaller than the texture image to be applied (typically far away objects). Effectively controls whether the GPU will select the "nearest" texel in the texture image or do linear interpolation (smoothing) or even interpolate between mipmap levels (subsampled versions of the base image). Using NEAREST may allow better performance, but the LINEAR options produce much higher quality rendering.The default value (AUTO) means that the minification filter setting is actually controlled by the
SoComplexity.textureQuality
field.- Since:
- Open Inventor 5.0
-
magFilter
public final SoSFEnum<SoTexture.Filters> magFilter
Specifies the OpenGL magFilter. Use enumFilter
. Default is AUTO. Only the following Filter values are valid: AUTO, NEAREST, and LINEAR.The magnification filter is used when the rendered size of the geometry is larger than the texture image to be applied (typically near objects). Effectively controls whether the GPU will select the "nearest" texel in the texture image or do linear interpolation (smoothing). Using NEAREST may allow better performance, but the LINEAR options produce much higher quality rendering.
Only the values NEAREST and LINEAR are valid in this field (see OpenGL specification).
The default value (AUTO) means that the magnification filter setting is actually controlled by the
SoComplexity.textureQuality
field.- Since:
- Open Inventor 5.0
-
-
Method Detail
-
readTexture
public static SbRasterImage readTexture(java.lang.String filename)
Calls readTexture(filename, SoTexture.FileTypes.valueOf( SoTexture.FileTypes.UNKNOWN.getValue() )).
-
setBitmapFileType
public void setBitmapFileType(SoTexture.FileTypes in_type)
Sets the texture file format. Default is UNKNOWN. If file type is set to UNKNOWN, Open Inventor tries to determine the file type from the file name extension (e.g., foo. gif implies a GIF file). If the set or determined file type is not UNKNOWN, Open Inventor attempts to read the file as that format. If this fails, Open Inventor will try reading the file as each possible format in turn. It is not necessary to set the file type if the image file has the standard file name extension.
-
getBitmapFileType
public SoTexture.FileTypes getBitmapFileType()
Gets the texture file format.
-
readTexture
public static SbRasterImage readTexture(java.lang.String filename, SoTexture.FileTypes filetype)
Convenience function that loads the image data from any texture file supported by Open Inventor and returns anSbRasterImage
object. Returns null if the load fails for any reason.If the file type is known, you may specify it using the
FileType
enum and Open Inventor will use the corresponding image reader. If filetype is UNKNOWN, Open Inventor will try to automatically determine which image reader should be used for the given file.
-
isSupported
public static boolean isSupported(SoTexture.HW_Features feature)
Returns information about hardware support for various texture features. When using a debug build of Open Inventor, some "no context available" warning messages may be generated. You can ignore them or seeSoGLExtension
for an example of usingSoGLContext
to avoid them.
-
-