Shader parameter node storing a texture image. More...
#include <Inventor/nodes/SoShaderParameterImage.h>
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 |
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.
name | "" |
identifier | 0 |
texture | NULL |
layer | -1 |
accessMode | READ |
SoShaderParameter, SoShaderParameterBufferObject, SoUniformShaderParameter, SoShaderObject, SoShaderProgram
NOTE: node available since Open Inventor 10.12SoShaderParameterImage::SoShaderParameterImage | ( | ) |
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.
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.