Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoExtTexture2 Class Reference

VSG extension Extended texture mapping node. More...

#include <Inventor/nodes/SoExtTexture2.h>

+ Inheritance diagram for SoExtTexture2:

Public Types

enum  Sync {
  SYNCHRONOUS = 0 ,
  ASYNCHRONOUS
}
 Synchrone/asynchrone loading mode. More...
 
enum  Loading {
  AUTO = 0 ,
  MANUAL
}
 Loading mode. More...
 
typedef SbBool ExtPrequalifyFileCallback(const SbString &, void *, SoExtTexture2 *)
 
typedef void SoExtTexture2CB(void *userData, SoExtTexture2 *tex)
 
- Public Types inherited from SoTexture
enum  InternalFormat {
  AUTO_INTERNAL_FORMAT ,
  ALPHA_FORMAT ,
  ALPHA4 ,
  ALPHA8 ,
  ALPHA12 ,
  ALPHA16 ,
  LUMINANCE_FORMAT ,
  LUMINANCE4 ,
  LUMINANCE8 ,
  LUMINANCE12 ,
  LUMINANCE16 ,
  LUMINANCE_ALPHA ,
  LUMINANCE4_ALPHA4 ,
  LUMINANCE6_ALPHA2 ,
  LUMINANCE8_ALPHA8 ,
  LUMINANCE12_ALPHA4 ,
  LUMINANCE12_ALPHA12 ,
  LUMINANCE16_ALPHA16 ,
  INTENSITY_FORMAT ,
  INTENSITY4 ,
  INTENSITY8 ,
  INTENSITY12 ,
  INTENSITY16 ,
  R3_G3_B2 ,
  RGB_FORMAT ,
  RGB4 ,
  RGB5 ,
  RG8 ,
  RGB8 ,
  RGB10 ,
  RGB12 ,
  RGB16 ,
  RGBA_FORMAT ,
  RGBA2 ,
  RGBA4 ,
  RGB5_ALPHA1 ,
  RGBA8 ,
  RGB10_ALPHA2 ,
  RGBA12 ,
  RGBA16 ,
  RGBA_FLOAT32 ,
  RGB_FLOAT32 ,
  ALPHA_FLOAT32 ,
  INTENSITY_FLOAT32 ,
  LUMINANCE_FLOAT32 ,
  LUMINANCE_ALPHA_FLOAT32 ,
  RGBA_FLOAT16 ,
  RGB_FLOAT16 ,
  ALPHA_FLOAT16 ,
  INTENSITY_FLOAT16 ,
  LUMINANCE_FLOAT16 ,
  LUMINANCE_ALPHA_FLOAT16 ,
  COMPRESSED_ALPHA ,
  COMPRESSED_LUMINANCE ,
  COMPRESSED_LUMINANCE_ALPHA ,
  COMPRESSED_INTENSITY ,
  COMPRESSED_RGB ,
  COMPRESSED_RGBA ,
  COMPRESSED_LUMINANCE_LATC1 ,
  COMPRESSED_SIGNED_LUMINANCE_LATC1 ,
  COMPRESSED_LUMINANCE_ALPHA_LATC2 ,
  COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2 ,
  COMPRESSED_RED_RGTC1 ,
  COMPRESSED_SIGNED_RED_RGTC1 ,
  COMPRESSED_RED_GREEN_RGTC2 ,
  COMPRESSED_SIGNED_RED_GREEN_RGTC2 ,
  DEPTH_COMPONENT16 ,
  DEPTH_COMPONENT24 ,
  DEPTH24_STENCIL8 ,
  R8I ,
  R8UI ,
  R16I ,
  R16UI ,
  R32I ,
  R32UI ,
  RG8I ,
  RG8UI ,
  RG16I ,
  RG16UI ,
  RG32I ,
  RG32UI ,
  RGB8I ,
  RGB8UI ,
  RGB16I ,
  RGB16UI ,
  RGB32I ,
  RGB32UI ,
  RGBA8I ,
  RGBA8UI ,
  RGBA16I ,
  RGBA16UI ,
  RGBA32I ,
  RGBA32UI
}
 Texture internal storage format. More...
 
enum  Model {
  MODULATE = SbEnums::TEX_MODEL_MODULATE ,
  DECAL = SbEnums::TEX_MODEL_DECAL ,
  BLEND = SbEnums::TEX_MODEL_BLEND ,
  REPLACE = SbEnums::TEX_MODEL_REPLACE ,
  ADD = SbEnums::TEX_MODEL_ADD ,
  COMBINE = SbEnums::TEX_MODEL_COMBINE
}
 Texture Combiner Functions. More...
 
enum  Wrap {
  REPEAT = SbEnums::TEX_ADDRESS_REPEAT ,
  CLAMP = SbEnums::TEX_ADDRESS_CLAMP ,
  CLAMP_TO_BORDER = SbEnums::TEX_ADDRESS_CLAMP_BORDER ,
  CLAMP_TO_EDGE = SbEnums::TEX_ADDRESS_CLAMP_TO_EDGE ,
  MIRRORED_REPEAT = SbEnums::TEX_ADDRESS_MIRROR_REPEAT
}
 Texture wrap type. More...
 
enum  Filter {
  AUTO = SbEnums::TEX_FILTER_AUTO ,
  NEAREST = SbEnums::TEX_FILTER_NEAREST ,
  LINEAR = SbEnums::TEX_FILTER_LINEAR ,
  NEAREST_MIPMAP_NEAREST = SbEnums::TEX_FILTER_NEAREST_MIPMAP_NEAREST ,
  NEAREST_MIPMAP_LINEAR = SbEnums::TEX_FILTER_NEAREST_MIPMAP_LINEAR ,
  LINEAR_MIPMAP_NEAREST = SbEnums::TEX_FILTER_LINEAR_MIPMAP_NEAREST ,
  LINEAR_MIPMAP_LINEAR = SbEnums::TEX_FILTER_LINEAR_MIPMAP_LINEAR
}
 Specifies the OpenGL filtering method for minification and magnification. More...
 
enum  HW_Feature {
  HW_NPOT = 0 ,
  HW_FLOATFORMAT ,
  HW_DEPTHFORMAT ,
  HW_AUTOMIPMAP ,
  HW_BORDER_CLAMP ,
  HW_EDGE_CLAMP ,
  HW_MIRRORED_REPEAT ,
  HW_COMPRESSION_S3TC ,
  HW_COMPRESSION_LATC ,
  HW_COMPRESSION_RGTC
}
 
enum  FileType {
  UNKNOWN ,
  RGB ,
  SGI ,
  TIFF ,
  GIF ,
  JPEG ,
  BMP ,
  PNG ,
  JPEG2000 ,
  PGX ,
  PNM ,
  RAS ,
  DDS ,
  HDRI ,
  NUM_FILETYPES
}
 File Type possible values. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoExtTexture2 ()
 Creates a texture node with default settings.
 
void allowPrequalifyFile (SbBool)
 If TRUE, allows the PrequalifyFile callback to be called.
 
void getImageSize (SbVec2s &size, int &nc)
 Returns the size and the number of components in the image.
 
void addOnLoadStartCB (SoExtTexture2CB *cb, void *userData)
 Callback invoked when starting loading the texture.
 
void addOnLoadFinishCB (SoExtTexture2CB *cb, void *userData)
 Callback invoked when the texture is loaded and ready to use.
 
void addOnUnloadCB (SoExtTexture2CB *cb, void *userData)
 Callback invoked when the texture is unloaded.
 
void loadTexture ()
 Loads the texture if the loading mode is set to MANUAL.
 
- Public Member Functions inherited from SoTexture
void setBitmapFileType (FileType in_type)
 Sets the texture file format.
 
FileType getBitmapFileType (void)
 Gets the texture file format.
 
virtual void setOverride (const SbBool state)
 Set the state of the override field.
 
virtual SbBool isOverride () const
 Returns the state of the override field.
 
- Public Member Functions inherited from SoNode
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void setPrequalifyFileCallBack (ExtPrequalifyFileCallback *p_cb, void *u_data)
 This callback is called by SoExtTexture2 nodes just before opening a file with the proposed path.
 
static void setMemorySpace (double megaBytes)
 Sets the system memory space allowed for the texture images.
 
static double getMemorySpace ()
 Gets the system memory space allowed for the texture images.
 
static double getGlobalMemoryUsed ()
 Return the current system memory used by all texture images.
 
static void useTexturePalette (SbBool value)
 If TRUE, uses a 256-color-indexed palette.
 
- Static Public Member Functions inherited from SoTexture
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SbBool isSupported (HW_Feature feature)
 Returns information about hardware support for various texture features.
 
static SbRasterImagereadTexture (const SbString &filename, FileType filetype=UNKNOWN)
 Convenience function that loads the image data from any texture file supported by Open Inventor and returns an SbRasterImage object.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFFilePathString filename
 Names file from which to read texture image.
 
SoSFEnum wrapT
 Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1.
 
SoSFBool loadingStatus
 Tells if the texture is loaded or not (not necessarily displayed)
 
SoSFEnum syncMode
 Specifies the synchronous/asynchronous mode.
 
SoSFEnum loadingMode
 Specifies the loading mode.
 
SoSFInt32 loadingThreadPriority
 Specifies the priority of the texture loading thread when activated (syncMode = ASYNCHRONOUS).
 
- Public Attributes inherited from SoTexture
SoSFEnum internalFormat
 Internal format for texture storage.
 
SoSFBool enableCompressedTexture
 Enables storage of textures on the graphics board in compressed form.
 
SoSFEnum wrapS
 Indicates what to do when texture coordinates in the S (horizontal) direction lie outside the range 0-1.
 
SoSFEnum model
 Specifies how to map texture onto surface.
 
SoSFColor blendColor
 Color used for BLEND model.
 
SoSFBool enableBorder
 Enables borders for textures.
 
SoSFVec4f borderColor
 Defines border color used for border texture filtering.
 
SoSFFloat maxAnisotropy
 Specifies on a per-texture object basis, the maximum degree of anisotropy to account for in texture filtering.
 
SoSFEnum minFilter
 Specifies the OpenGL minFilter.
 
SoSFEnum magFilter
 Specifies the OpenGL magFilter.
 

Detailed Description

VSG extension Extended texture mapping node.

This property node defines a texture map and parameters for that map. This map is used to apply texture to subsequent shapes as they are rendered.

The node is similar to SoTexture2, but differs in the following significant ways:

  1. It has no image field.
  2. It doesn't load the texture image into system memory until the node is traversed. Depending on the scene graph, this may significantly reduce the use of system memory, e.g., if the scene has lots of LODs containing textures. On the other hand, when the scene graph is first traversed there may be a small delay while the textures are being loaded.
  3. It has additional features (e.g., support for OpenGL paletted textures) for reducing the use of texture memory.

The texture is read from the file specified by the filename field. There is no image field created. Data is sent directly to OpenGL.

The maximum system memory allowed for all SoExtTexture2 nodes (in total) can be set using setMemorySpace().

If the memory allowed for texture images (setMemorySpace()) would be exceeded by loading a new image, one or more existing images will be deleted from system memory. In most cases OpenGL texture objects will already have been created for the deleted images (i.e. OpenGL has a copy of the images), so this does not affect rendering.

If it is necessary to recreate an OpenGL texture object and the required texture image has been deleted from system memory, the node will automatically re-read the image file. For this reason, applications should be careful not to remove image files that might be needed during program execution.

To reduce the use of texture memory (by approximately a factor of 4), use the useTexturePalette() method to request the image be converted to a 256-color paletted image. This feature is available only if the driver supports the GL_EXT_paletted_texture or GL_EXT_texture_color_table extension.

If the texture image's width or height is not a power of 2, and the Non Power Of Two (NPOT) extension is available on your graphics board, by default Open Inventor will send the image to OpenGL without modification. However, if the texture image's width or height is not a power of 2 (and the Non Power Of Two (NPOT) extension is not available on your graphics board), or the image's width or height is greater than the maximum supported by OpenGL, then the image will be automatically scaled up or down to the nearest power of 2 or the maximum texture size. For maximum speed, point-sampling is used to do the scaling. If you want higher quality scaling, pre-filter your images to a power of 2 smaller than the maximum texture size. Use the OpenGL glGetIntegerv(GL_MAX_TEXTURE_SIZE...) call to determine the maximum texture dimension for a specific OpenGL implementation. Setting the environment variable OIV_USE_NPOT to 0 will force the image to be rescaled (when necessary) even if the NPOT extension is available.

The quality of the texturing is affected by the textureQuality field of the SoComplexity node. The textureQuality field affects what kind of filtering is done to the texture when it must be minified or magnified. The mapping of a particular texture quality value to a particular OpenGL filtering technique is platform dependent, and varies based on the texturing performance. If mipmap filtering is required, mipmaps are automatically created using a simple box filter.

Performance Note: Automatic scaling of texture images to a power of 2 is a very convenient feature for prototyping, but it does take additional time the first time the texture node is traversed for rendering. For large images, or a large number of images, this can make the application seem slow while starting up or loading a new data file. Avoid this effect by either pre-scaling the image or by storing it as a sub-image in a "power of 2" image (then provide explicit texture coordinates such that only the sub-image is used).

FILE FORMAT/DEFAULT

    ExtTexture2 {
    filename ""
    enableCompressedTexture FALSE
    wrapS REPEAT
    wrapT REPEAT
    model MODULATE
    blendColor 0 0 0
    loadingStatus FALSE
    syncMode SYNCHRONOUS
    loadingMode AUTO
    loadingThreadPriorty 1
    enableBorder FALSE
    borderColor 0 0 0 0
    maxAnisotropy 1.0
    minFilter AUTO
    magFilter AUTO
    useAutoMipmap FALSE
    internalFormat AUTO_INTERNAL_FORMAT
    }

ACTION BEHAVIOR

SEE ALSO

SoTexture2, SoComplexity, SoMaterial, SoTexture2Transform, SoTextureCoordinate2, SoTextureCoordinateBinding, SoTextureCoordinateFunction

Definition at line 181 of file SoExtTexture2.h.

Member Typedef Documentation

◆ ExtPrequalifyFileCallback

typedef SbBool ExtPrequalifyFileCallback(const SbString &, void *, SoExtTexture2 *)

Definition at line 58 of file SoExtTexture2.h.

◆ SoExtTexture2CB

typedef void SoExtTexture2::SoExtTexture2CB(void *userData, SoExtTexture2 *tex)

Definition at line 191 of file SoExtTexture2.h.

Member Enumeration Documentation

◆ Loading

Loading mode.

Enumerator
AUTO 

The texture is loaded at the node's traversal.

MANUAL 

The texture is loaded by the user using the loadTexture method.

Definition at line 208 of file SoExtTexture2.h.

◆ Sync

Synchrone/asynchrone loading mode.

Enumerator
SYNCHRONOUS 

The loading is blocking (no thread launched).

ASYNCHRONOUS 

The loading is non blocking (the loading is done within a thread).

Definition at line 194 of file SoExtTexture2.h.

Constructor & Destructor Documentation

◆ SoExtTexture2()

SoExtTexture2::SoExtTexture2 ( )

Creates a texture node with default settings.

Member Function Documentation

◆ addOnLoadFinishCB()

void SoExtTexture2::addOnLoadFinishCB ( SoExtTexture2CB cb,
void *  userData 
)

Callback invoked when the texture is loaded and ready to use.

◆ addOnLoadStartCB()

void SoExtTexture2::addOnLoadStartCB ( SoExtTexture2CB cb,
void *  userData 
)

Callback invoked when starting loading the texture.

◆ addOnUnloadCB()

void SoExtTexture2::addOnUnloadCB ( SoExtTexture2CB cb,
void *  userData 
)

Callback invoked when the texture is unloaded.

◆ allowPrequalifyFile()

void SoExtTexture2::allowPrequalifyFile ( SbBool  )

If TRUE, allows the PrequalifyFile callback to be called.

◆ getClassTypeId()

static SoType SoExtTexture2::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getGlobalMemoryUsed()

static double SoExtTexture2::getGlobalMemoryUsed ( )
static

Return the current system memory used by all texture images.

◆ getImageSize()

void SoExtTexture2::getImageSize ( SbVec2s size,
int &  nc 
)

Returns the size and the number of components in the image.

◆ getMemorySpace()

static double SoExtTexture2::getMemorySpace ( )
static

Gets the system memory space allowed for the texture images.

This value is specified in megabytes (MB).

◆ getTypeId()

virtual SoType SoExtTexture2::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoTexture.

◆ loadTexture()

void SoExtTexture2::loadTexture ( )

Loads the texture if the loading mode is set to MANUAL.

◆ setMemorySpace()

static void SoExtTexture2::setMemorySpace ( double  megaBytes)
static

Sets the system memory space allowed for the texture images.

This value is specified in megabytes (MB). The default is 16 MB.

◆ setPrequalifyFileCallBack()

static void SoExtTexture2::setPrequalifyFileCallBack ( ExtPrequalifyFileCallback p_cb,
void *  u_data 
)
static

This callback is called by SoExtTexture2 nodes just before opening a file with the proposed path.

It allows you to modify the path and/or indicate that the texture has already been handled.

You could use the callback, for example, to load an image in a file format that Open Inventor doesn't natively support. The callback could

  • detect (by examining the path) that the file is of a particular format,
  • call application-supplied code to read the texture file
  • set the image into the image field of the texture node
  • set the flag indicating that the texture has been handled.

◆ useTexturePalette()

static void SoExtTexture2::useTexturePalette ( SbBool  value)
static

If TRUE, uses a 256-color-indexed palette.

You must call this method before the textures are loaded. Default is FALSE.
NOTE: If the field enableCompressedTexture is set TRUE, its value takes precedence over this request to use a paletted texture. Compressed textures will be used.

Member Data Documentation

◆ filename

SoSFFilePathString SoExtTexture2::filename

Names file from which to read texture image.

The standard image file formats are supported. See SoRasterImageRW for the list. If the filename is not an absolute path name, the list of directories maintained by SoInput is searched. If the texture is not found in any of those directories, then the file is searched for relative to the directory from which the SoTexture2 node was read. For example, if an SoTexture2 node with a filename of "../tofu.rgb" is read from /usr/people/bob/models/food.iv, then /usr/people/bob/tofu.rgb will be read (assuming tofu.rgb isn't found in the directories maintained by SoInput).

Definition at line 232 of file SoExtTexture2.h.

◆ loadingMode

SoSFEnum SoExtTexture2::loadingMode

Specifies the loading mode.

Use enum Loading. Default is AUTO.

Definition at line 257 of file SoExtTexture2.h.

◆ loadingStatus

SoSFBool SoExtTexture2::loadingStatus

Tells if the texture is loaded or not (not necessarily displayed)

Definition at line 245 of file SoExtTexture2.h.

◆ loadingThreadPriority

SoSFInt32 SoExtTexture2::loadingThreadPriority

Specifies the priority of the texture loading thread when activated (syncMode = ASYNCHRONOUS).

This part uses the SbThread class.

Definition at line 263 of file SoExtTexture2.h.

◆ syncMode

SoSFEnum SoExtTexture2::syncMode

Specifies the synchronous/asynchronous mode.

Use enum Sync. Default is SYNCHRONOUS.

Definition at line 251 of file SoExtTexture2.h.

◆ wrapT

SoSFEnum SoExtTexture2::wrapT

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.

Definition at line 239 of file SoExtTexture2.h.


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