public class SoIndexedTexture2 extends SoTexture
SoTexture2
, each texel contains a color value that is directly applied to the geometry. In this node each texel contains a
data value that is mapped to a color value using the color map defined by the current SoColorMap
node.
This image is stored in the current texture unit (see SoTextureUnit
) and the texture is applied to subsequent shapes as they are rendered.
The image data is stored in an SoSFArray2D
. This array can contain different types of data (UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT32, SIGNED_BYTE, SIGNED_SHORT, SIGNED_INT32, FLOAT).
When Open Inventor creates the OpenGL texture image from the data array, the data values must be scaled into the range of values of the texture (0-255 for an 8-bit indexed texture). The minValue
and maxValue
fields specify the range of data values that will be scaled into the range of texture values. For example, if minValue
is set to 10000 and maxValue
to 38000, all values less than or equal to 10000 will be mapped to the entry 0 of the color map and all values greater than or equal to 38000 to the last entry. The image below illustrates the process of mapping and shows how it can be used to map only the used data range to the color map:
If minValue
or maxValue
change, then the OpenGL texture must be recreated. If the texture is large, this may be time consuming. Generally it's more efficient to modify the SoColorMap
node because the OpenGL texture corresponding to the data does not need to be recreated
NOTE: Texture data values are stored with 12 bits of precision instead of the usual 8 bits, when:
ARB_fragment_program is supported by the graphics card. The number of color map entries is greater than 256. The texture data type has more than 8 bits of precision (i.e., not UNSIGNED_BYTE or SIGNED_BYTE).
The following example shows how to apply an indexed texture on a geometry node:
SoColorMap colorMap = new SoColorMap(); colorMap.predefinedColorMap.setValue( SoColorMap.PredefinedColorMaps.TEMPERATURE ); colorMap.min.setValue( -1000 ); colorMap.max.setValue( 20000 ); SoIndexedTexture2 indexedTexture = new SoIndexedTexture2(); indexedTexture.imageIndex.setValue(size, SoSFArray.DataTypes.SIGNED_SHORT, data); root.addChild( colorMap ); root.addChild( indexedTexture ); root.addChild( geometry );
On graphics cards supporting
ARB_fragment_program , the model
field will be ignored and multitexturing will not work. It is possible to circumvent this limitation by using a custom shader. The following GLSL code shows how to do multitexturing between two indexed textures sharing the same color map:
IndexedTexture2 {
Action behavior:
See also:
The scene graph would be initialized like this:
File format/default:
}
minValue 0
maxValue 0
imageIndex 0 0
rescaleTexCoord false
wrapS REPEAT
wrapT REPEAT
model MODULATE
blendColor 0 0 0
enableBorder false
borderColor 0 0 0 0
maxAnisotropy 1.0
minFilter AUTO
magFilter AUTO
useAutoMipmap false
internalFormat AUTO_INTERNAL_FORMAT
SoGLRenderAction
, SoCallbackAction
Sets: SoTextureImageElement
SoTexture2Transform
, SoTextureCoordinate2
, SoTextureCoordinateFunction
, SoColorMap
, SoSFArray2D
.
SoTexture.FileTypes, SoTexture.Filters, SoTexture.HW_Features, SoTexture.InternalFormats, SoTexture.Models, SoTexture.WrapType
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFArray2D |
imageIndex
This field contains the in-memory representation of the indexed texture image.
|
SoSFFloat |
maxValue
See
minValue . |
SoSFFloat |
minValue
Specifies the range of values which is mapped onto the color map (see
SoColorMap ). |
SoSFBool |
rescaleTexCoord
This field controls the way an image with non-power-of-two dimension is handled:
If the graphics card supports
GL_ARB_texture_non_power_of_two , this field is ignored and the image is sent directly to OpenGL.
|
SoSFEnum<SoTexture.WrapType> |
wrapT
Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1.
|
ADD, ALPHA_FLOAT16, ALPHA_FLOAT32, ALPHA_FORMAT, ALPHA12, ALPHA16, ALPHA4, ALPHA8, AUTO, AUTO_INTERNAL_FORMAT, BLEND, blendColor, BMP, borderColor, CLAMP, CLAMP_TO_BORDER, CLAMP_TO_EDGE, COMBINE, COMPRESSED_ALPHA, COMPRESSED_INTENSITY, COMPRESSED_LUMINANCE, COMPRESSED_LUMINANCE_ALPHA, COMPRESSED_LUMINANCE_ALPHA_LATC2, COMPRESSED_LUMINANCE_LATC1, COMPRESSED_RED_GREEN_RGTC2, COMPRESSED_RED_RGTC1, COMPRESSED_RGB, COMPRESSED_RGBA, COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2, COMPRESSED_SIGNED_LUMINANCE_LATC1, COMPRESSED_SIGNED_RED_GREEN_RGTC2, COMPRESSED_SIGNED_RED_RGTC1, DDS, DECAL, DEPTH_COMPONENT16, DEPTH_COMPONENT24, DEPTH24_STENCIL8, enableBorder, enableCompressedTexture, GIF, HDRI, HW_AUTOMIPMAP, HW_BORDER_CLAMP, HW_COMPRESSION_LATC, HW_COMPRESSION_RGTC, HW_COMPRESSION_S3TC, HW_DEPTHFORMAT, HW_EDGE_CLAMP, HW_FLOATFORMAT, HW_LAST, HW_MIRRORED_REPEAT, HW_NPOT, INTENSITY_FLOAT16, INTENSITY_FLOAT32, INTENSITY_FORMAT, INTENSITY12, INTENSITY16, INTENSITY4, INTENSITY8, internalFormat, JPEG, JPEG2000, LINEAR, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, LUMINANCE_ALPHA, LUMINANCE_ALPHA_FLOAT16, LUMINANCE_ALPHA_FLOAT32, LUMINANCE_FLOAT16, LUMINANCE_FLOAT32, LUMINANCE_FORMAT, LUMINANCE12, LUMINANCE12_ALPHA12, LUMINANCE12_ALPHA4, LUMINANCE16, LUMINANCE16_ALPHA16, LUMINANCE4, LUMINANCE4_ALPHA4, LUMINANCE6_ALPHA2, LUMINANCE8, LUMINANCE8_ALPHA8, magFilter, maxAnisotropy, minFilter, MIRRORED_REPEAT, model, MODULATE, NEAREST, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, NUM_FILETYPES, PGX, PNG, PNM, R3_G3_B2, RAS, REPEAT, REPLACE, RGB, RGB_FLOAT16, RGB_FLOAT32, RGB_FORMAT, RGB10, RGB10_ALPHA2, RGB12, RGB16, RGB4, RGB5, RGB5_ALPHA1, RGB8, RGBA_FLOAT16, RGBA_FLOAT32, RGBA_FORMAT, RGBA12, RGBA16, RGBA2, RGBA4, RGBA8, SGI, TIFF, UNKNOWN, useAutoMipmap, wrapS
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoIndexedTexture2()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
computeDataRange()
|
getBitmapFileType, isSupported, setBitmapFileType
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public final SoSFFloat minValue
SoColorMap
).
When minValue
and maxValue
are equal to 0 (the default), the entire range of the data type is mapped onto the color map, except in the case of float data. For example, for a color map of size N:
With unsigned byte values, [0-255] is mapped onto the color map [0 - N-1] With unsigned short values, [0-65535] is mapped onto the color map [0 - N-1] With signed short values, [-32768 - 32767] is mapped onto the color map [0 - N-1]. With float data type, [0-1] is mapped onto the color map [0 - N-1]
All values less than or equal to minValue
will be mapped to the first entry of the color map. Likewise, all values greater than or equal to maxValue
will be mapped to the last entry of the color map.
public final SoSFArray2D imageIndex
public final SoSFBool rescaleTexCoord
rescaleTexCoord
is false (the default), the image is rescaled to the next lower power-of-two dimensions. The scaling is done with a box filter.
rescaleTexCoord
is true, the image is not rescaled but is only copied into a texture with the next higher power-of-two dimension, and its texture coordinates are scaled by applying a texture transform in order to only display the actual image.
Default is false.
When this field is enabled, if other texture transforms are applied to the texture coordinates (especially if the texture is repeated), the unused part of the larger texture could be displayed. Furthermore, in this mode, if non-power-of-two textures occur one after another in the scene graph, an incorrect image may result because texture transforms are cumulative. For example, the following code would give incorrect results:
The correct way is to use a separator above each texture, as shown:
public final SoSFEnum<SoTexture.WrapType> wrapT
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com