The WebGL Computational Library
Documentation Installation Textures Texture Float32Texture Int32Texture Uint32Texture ImageTexture CanvasTexture TableTexture copyTexture Solvers Solver Copy setUniformInSolvers setUniformsInSolvers SignalPlot Plot1D Plot2D Tvsx VolumeRayCaster getColormapList Probe TextureReader ProbeRecorder IntervalCaller saveCanvas APD OrbitalCameraControl MouseListener ClickListener DoubleClickListener CtrlClickListener ShiftClickListener CommandClickListener CtrlShiftClickListener ShiftCtrlClickListener LongClickListener Storage saveToXML loadFromXML xorwow random Gui Editor glMatrix

Float32Texture (class)

Float32Texture is the class for the most widely used textures in the library. This is an extension of the Texture class. It is a texture with RGBA colors and 32 bit floats format for each color channel. The texture is color renderable and filterable.

The internal format of the texture is 'rgba32f', the format is 'rgba' and the type is float.


The constructor can be called as

var textureInstance = new Abubu.Float32Texture( width, height, options ) ;

The arguments are:

  1. width

    integer number of pixels in the horizontal direction

  2. height

    integer number of pixels in the vertical direction

  3. options

    object of optional named arguments. If none is provided, the default values will be assumed. The options object's available properties are:

    • wrapS

      String indicating wrapping in the horizontal direction. Possible values are

         'clamp_to_edge'   (default)
    • wrapT

      String indicating wrapping in the vertical direction. Possible values are

         'clamp_to_edge'   (default)
    • magFilter

      Texture magnification filter. Possible values are

         'nearest'         (default)
    • minFilter

      Texture minification filter. Possible values are

         'nearest'         (default)
    • data

      One dimensional Float32Array of the appropriate size which can be used to initialize the texture from the JavaScript. The array type should match the total size of texture (number of pixels \( \times \) number of color channels (4)).

    • pairable
      boolean value representing weather texture should be paired be with a JavaScript array by default. If this option is true the value property can be used to read the texture into CPU as a one dimensional array.
      Default value: false

Instance properties

The following properties have read and write permissions and hence can be modified.

\(^* \)Requires updating new data array as with texture size change the data cannot be automatically mapped.

\(^\dagger\)Dangerous to modify property! Only modify with caution.

\(^\ddagger \)Read-Only property.

For more information on these properties, see the explanations in the constructor section.


Consider the code snippet below:

var my_texture = new Abubu.Float32Texture( 200, 300, 
      wrapS    : 'mirrored_repeat', 
      wrapT    : 'clampt_to_edge',
      magFilter: 'linear',
      minFilter: 'nearest',
      pairable : true 
) ;

my_texture.magFilter = 'linear_mipmap_linear' ;

console.log(my_texture.value) ;

It generates a 200 by 300 Float32Texture. Wrapping in the S and T directions, as well as minification and magnification filters are initially set by the construction options. However, magnification filter is later changed by setting the instance's magFilter property to 'linear_mipmap_linear'.

Since the texture is pairable, the values of the pixels of the texture can be accessed by the value property and can be printed to the browser's console.