Package com.google.android.exoplayer2.util

## Class GlUtil.Uniform

- java.lang.Object
- - com.google.android.exoplayer2.util.GlUtil.Uniform

- Enclosing class:
    GlUtil

      public static final class GlUtil.Uniform
      extends Object

  GL uniform, which can be attached to a sampler using `setSamplerTexId(int, int)`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `String` | `name` | The name of the uniform in the GLSL sources.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Uniform​(int program, int index)` | Creates a new GL uniform.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `bind()` | Sets the uniform to whatever value was passed via `setSamplerTexId(int, int)`, `setFloat(float)` or `setFloats(float[])`.
    `void` | `setFloat​(float value)` | Configures `bind()` to use the specified float `value` for this uniform.
    `void` | `setFloats​(float[] value)` | Configures `bind()` to use the specified float[] `value` for this uniform.
    `void` | `setSamplerTexId​(int texId, int unit)` | Configures `bind()` to use the specified `texId` for this sampler uniform.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### name

          public final String name

      The name of the uniform in the GLSL sources.

  - ### Constructor Detail

    - #### Uniform

          public Uniform​(int program,
                         int index)

      Creates a new GL uniform.
      Parameters:
        `program` - The identifier of a compiled and linked GLSL shader program.
        `index` - The index of the uniform. After this instance has been constructed, the name of the uniform is available via the `name` field.

  - ### Method Detail

    - #### setSamplerTexId

          public void setSamplerTexId​(int texId,
                                      int unit)

      Configures `bind()` to use the specified `texId` for this sampler uniform.
      Parameters:
        `texId` - The GL texture identifier from which to sample.
        `unit` - The GL texture unit index.

    - #### setFloat

          public void setFloat​(float value)

      Configures `bind()` to use the specified float `value` for this uniform.

    - #### setFloats

          public void setFloats​(float[] value)

      Configures `bind()` to use the specified float[] `value` for this uniform.

    - #### bind

          public void bind()

      Sets the uniform to whatever value was passed via `setSamplerTexId(int, int)`, `setFloat(float)` or `setFloats(float[])`.

      Should be called before each drawing call.