Class SoShaderParameterImage

  • All Implemented Interfaces:
    SafeDisposable

    public class SoShaderParameterImage
    extends SoShaderParameter
    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:

    ShaderParameterImage {

      name ""
      identifier 0
      texture NULL
      layer -1
      accessMode READ
    }

    Since:
    Open Inventor 10.12

    See Also:
    SoShaderParameter, SoShaderParameterBufferObject, SoUniformShaderParameter, SoShaderObject, SoShaderProgram
    • Field Detail

      • texture

        public final SoSFNode texture
        Specifies the texture to bind to the image unit. Default is NULL.
      • layer

        public final SoSFInt32 layer
        Specifies the layer of texture to be bound to the image unit. Default is -1 (bind all layers).
    • Constructor Detail

      • SoShaderParameterImage

        public SoShaderParameterImage()