SoShaderParameterImage Class Reference
[Shaders]

VSG extension Shader parameter node storing a texture image. More...

#include <Inventor/nodes/SoShaderParameterImage.h>

Inheritance diagram for SoShaderParameterImage:
SoShaderParameter SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Types

enum  AccessMode {
  READ = SbEnums::READ,
  WRITE = SbEnums::WRITE,
  READ_WRITE = SbEnums::READ_WRITE
}

Public Member Functions

virtual SoType getTypeId () const
 SoShaderParameterImage ()

Static Public Member Functions

static SoType getClassTypeId ()

Public Attributes

SoSFNode texture
SoSFInt32 layer
SoSFEnum accessMode

Detailed Description

VSG extension Shader parameter node storing a texture image.

This node allows the application to bind a texture to an image unit for the purpose of reading and writing it from shaders. texture specifies an existing texture node to bind to the image unit.

If texture is an SoTextureCubeMap or an SoTexture3 with SoTexture3::ARRAY layout, then it is possible to bind either the entire array, or only a single layer of the array to the image unit. In such cases, if layer is -1, the entire array is attached to the image unit. Otherwise, layer specifies the layer of the array to attach to the image unit.

accessMode specifies the access types to be performed by shaders and may be set to READ, WRITE, or READ_WRITE to indicate read-only, write-only or read-write access, respectively. Violation of the access type specified in accessMode (for example, if a shader writes to an image bound with accessMode set to READ) will lead to undefined results, possibly including program termination.

SoShaderParameterImage nodes are usually added to the field SoShaderProgram::images to affect only that specific shader program, but can also be inserted in the scene graph and affect all subsequent shader programs.

See Image Load Store section of the OpenGL wiki for more information about using this feature in GLSL.

As an example, here is how you could define a 2D write-only texture in GLSL:

  restrict writeonly uniform image2D myTexture;

Use "restrict" to allow the compiler to make optimizations when you know that this variable is the only one that will access the underlying texture.
Also note that the name of the variable ("myTexture" in the example) should correspond to the value of the field name.

FILE FORMAT/DEFAULT

SEE ALSO

SoShaderParameter, SoShaderParameterBufferObject, SoUniformShaderParameter, SoShaderObject, SoShaderProgram

NOTE: node available since Open Inventor 10.12


Member Enumeration Documentation

Image access modes.

Enumerator:
READ 

The shader can only read from the image.

WRITE 

The shader can only write to the image.

READ_WRITE 

The shader can read from and can write to the image.


Constructor & Destructor Documentation

SoShaderParameterImage::SoShaderParameterImage (  ) 

Member Function Documentation

static SoType SoShaderParameterImage::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoShaderParameter.

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

Returns the type identifier for this specific instance.

Reimplemented from SoShaderParameter.


Member Data Documentation

Specifies the type of access that will be performed on the image.

Use enum AccessMode. Default is READ.

Specifies the layer of texture to be bound to the image unit.

Default is -1 (bind all layers).

Specifies the texture to bind to the image unit.

Default is NULL.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/