Back to Exoplayer

GlProgram (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/util/GlProgram.html

latest8.2 KB
Original Source

Package com.google.android.exoplayer2.util

Class GlProgram


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classGlProgramextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Represents a GLSL shader program.

After constructing a program, keep a reference for its lifetime and call delete() (or release the current GL context) when it's no longer needed.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | GlProgram​(Context context, String vertexShaderFilePath, String fragmentShaderFilePath) | Deprecated.

Compiles a GL shader program from vertex and fragment shader GLSL GLES20 code. | | GlProgram​(String vertexShaderGlsl, String fragmentShaderGlsl) | Deprecated.

Creates a GL shader program from vertex and fragment shader GLSL GLES20 code. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | bindAttributesAndUniforms() | Deprecated.

Binds all attributes and uniforms in the program. | | void | delete() | Deprecated.

Deletes the program. | | int | getAttributeArrayLocationAndEnable​(String attributeName) | Deprecated.

Returns the location of an GlProgram.Attribute, which has been enabled as a vertex attribute array. | | int | getUniformLocation​(String uniformName) | Deprecated.

Returns the location of a GlProgram.Uniform. | | void | setBufferAttribute​(String name, float[] values, int size) | Deprecated.

Sets a float buffer type attribute. | | void | setFloatsUniform​(String name, float[] value) | Deprecated.

Sets a float[] type uniform. | | void | setFloatUniform​(String name, float value) | Deprecated.

Sets a float type uniform. | | void | setIntUniform​(String name, int value) | Deprecated.

Sets an int type uniform. | | void | setSamplerTexIdUniform​(String name, int texId, int texUnitIndex) | Deprecated.

Sets a texture sampler type uniform. | | void | use() | Deprecated.

Uses the program. |

- 

Methods inherited from class java.lang.Object

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

Constructor Detail

- 

GlProgram

public GlProgram​([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")vertexShaderFilePath,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fragmentShaderFilePath)
          throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io"),[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Compiles a GL shader program from vertex and fragment shader GLSL GLES20 code. Parameters:context - The Context.vertexShaderFilePath - The path to a vertex shader program.fragmentShaderFilePath - The path to a fragment shader program.Throws:IOException - When failing to read shader files.GlUtil.GlException

- 

GlProgram

public GlProgram​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")vertexShaderGlsl,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fragmentShaderGlsl)
          throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Creates a GL shader program from vertex and fragment shader GLSL GLES20 code.

This involves slow steps, like compiling, linking, and switching the GL program, so do not call this in fast rendering loops.

Parameters:vertexShaderGlsl - The vertex shader program.fragmentShaderGlsl - The fragment shader program.Throws:GlUtil.GlException

Method Detail

- 

getUniformLocation

public int getUniformLocation​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")uniformName)

Deprecated.

Returns the location of a GlProgram.Uniform.

- 

use

public void use()
         throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Uses the program.

Call this in the rendering loop to switch between different programs.

Throws:GlUtil.GlException

- 

delete

public void delete()
            throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Deletes the program. Deleted programs cannot be used again. Throws:GlUtil.GlException

- 

getAttributeArrayLocationAndEnable

public int getAttributeArrayLocationAndEnable​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")attributeName)
                                       throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Returns the location of an GlProgram.Attribute, which has been enabled as a vertex attribute array. Throws:GlUtil.GlException

- 

setBufferAttribute

public void setBufferAttribute​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name,
                               float[] values,
                               int size)

Deprecated.

Sets a float buffer type attribute.

- 

setSamplerTexIdUniform

public void setSamplerTexIdUniform​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name,
                                   int texId,
                                   int texUnitIndex)

Deprecated.

Sets a texture sampler type uniform. Parameters:name - The uniform's name.texId - The texture identifier.texUnitIndex - The texture unit index. Use a different index (0, 1, 2, ...) for each texture sampler in the program.

- 

setIntUniform

public void setIntUniform​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name,
                          int value)

Deprecated.

Sets an int type uniform.

- 

setFloatUniform

public void setFloatUniform​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name,
                            float value)

Deprecated.

Sets a float type uniform.

- 

setFloatsUniform

public void setFloatsUniform​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")name,
                             float[] value)

Deprecated.

Sets a float[] type uniform.

- 

bindAttributesAndUniforms

public void bindAttributesAndUniforms()
                               throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Binds all attributes and uniforms in the program. Throws:GlUtil.GlException