SoIndexedTexture2 Class Reference

VSG extension Class for 2D indexed texture. More...

#include <Inventor/nodes/SoIndexedTexture2.h>

Inheritance diagram for SoIndexedTexture2:
SoTexture SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Member Functions

virtual SoType getTypeId () const
void computeDataRange ()
 SoIndexedTexture2 ()

Static Public Member Functions

static SoType getClassTypeId ()

Public Attributes

SoSFFloat minValue
SoSFFloat maxValue
SoSFArray2D imageIndex
SoSFBool rescaleTexCoord
SoSFEnum wrapT

Detailed Description

VSG extension Class for 2D indexed texture.

This property node defines an "indexed" texture image. In a standard texture image, e.g. 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 -- only the texture containing the colormap, which is normally quite small.

NOTE: Texture data values are stored with 12 bits of precision instead of the usual 8 bits, when:






SoTexture2Transform, SoTextureCoordinate2, SoTextureCoordinateFunction, SoColorMap, SoSFArray2D.

See related examples:

IndexedTexture, SegY2D

Constructor & Destructor Documentation

SoIndexedTexture2::SoIndexedTexture2 (  ) 


Member Function Documentation

void SoIndexedTexture2::computeDataRange (  ) 

Compute the min and max value of the indexed image and put the result in minValue and maxValue.

static SoType SoIndexedTexture2::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoTexture.

virtual SoType SoIndexedTexture2::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoTexture.

Member Data Documentation

This field contains the in-memory representation of the indexed texture image.

Each value of this array is a color index. In the case of float values, data must be between 0 and 1.

See minValue.

Specifies the range of values which is mapped onto the color map (see 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.

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.
  • If 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.
  • If 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:

   root->addChild( colorMap );
   root->addChild( nonPowerOfTwoIndexedTexture1 );
   root->addChild( nonPowerOfTwoIndexedTexture2 );
   root->addChild( nonPowerOfTwoIndexedTexture3 );

The correct way is to use a separator above each texture, as shown:

   root->addChild( colorMap );
   root->addChild( separator1 );
     separator1->addChild( nonPowerOfTwoIndexedTexture1 );
   root->addChild( separator2);
     separator2->addChild( nonPowerOfTwoIndexedTexture2 );
   root->addChild( separator3);
     separator3->addChild( nonPowerOfTwoIndexedTexture3 );

Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1.

Use enum SoTexture::Wrap. Default is REPEAT.

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 28 Oct 2019
Copyright © Thermo Fisher Scientific All rights reserved.