Class SoTextureUnit
- 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.SoTextureUnit
-
- All Implemented Interfaces:
SafeDisposable
public class SoTextureUnit extends SoNode
Node that specifies the current texture unit and the associated mapping method. This node specifies the current texture unit for all subsequent 2D and 3D texture nodes (for example,SoTexture2
,SoTexture2Transform
,SoTextureCoordinate2
,SoTextureCoordinateBinding
, andSoTextureCoordinateFunction
).If the graphics board supports multitexturing (OpenGL 1.5 or GL_ARB_multitexture extension), then multiple textures, each defined by a texture unit, can be applied to the same shape. The maximum number of texture units depends on the board and can be queried using
getMaxTextureUnit
.Multitexturing is supported by the following shapes:
SoCone
SoCube
SoCylinder
SoFaceSet
SoIndexedFaceSet
SoIndexedQuadMesh
SoIndexedTriangleStripSet
SoQuadMesh
SoSphere
SoTriangleStripSet
Each texture unit is defined by the following texture properties:
- image of the texture (derived from
SoTexture
) - texture coordinates (
SoTextureCoordinate2
,SoTextureCoordinate3
,SoTextureCoordinateBinding
, etc.) - automatic texture coordinates generation (derived from
SoTextureCoordinateFunction
) - stack of matrix transforms (
SoTexture2Transform
,SoTexture3Transform
,SoMatrixTransform
, etc.) - mapping method: image mapping or bump mapping.
Limitations:
- Multitexturing is not supported for non convex shapes (
SoShapeHints.UNKNOWN_FACE_TYPE
). - Automatic texture coordinate generation (
SoTextureCoordinateFunction
) is not possible for the bump mapping method. - When not using shaders, only units 0 to 3 can be used.
- When using shaders, texture unit properties (listed above) can be defined for units 0 to 7. When shaders are used, it is also possible to use
SoVertexShaderParameter
to specify texture coordinates to be used by the shader(s).SoVertexShaderParameter
parameter sets are limited to 32 on OpenGL3 hardware.
File format/default:
TextureUnit {
unit 0 Action behavior:
SoGLRenderAction
,SoCallbackAction
Sets the current texture unit and the associated mapping method. Sets:SoTextureUnitElement
SoBumpMappingProperty,
SoTexture2
,SoTexture2Transform
,SoTextureCoordinate2
,SoTextureCoordinateBinding
,SoTextureCoordinateFunction
.
-
-
Nested Class Summary
-
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 SoSFUInt32
unit
Specifies the texture unit identifier.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoTextureUnit()
Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getMaxTextureUnit()
Calls getMaxTextureUnit((com.openinventor.inventor.misc.SoState)null).static int
getMaxTextureUnit(SoState state)
Returns the maximum number of texture units.-
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
-
unit
public final SoSFUInt32 unit
Specifies the texture unit identifier. Can range from 0 to the largest texture unit, which isgetMaxTextureUnit()
-1. Values greater than the largest texture unit are clamped at the largest texture unit.
-
-
Method Detail
-
getMaxTextureUnit
public static int getMaxTextureUnit()
Calls getMaxTextureUnit((com.openinventor.inventor.misc.SoState)null).
-
getMaxTextureUnit
public static int getMaxTextureUnit(SoState state)
Returns the maximum number of texture units. This is the max which can be used when a shader is on state. Without shaders, only the first 4 units (0..3) can be used.
-
-