docs/doc/reference/com/google/android/exoplayer2/util/GlUtil.html
Package com.google.android.exoplayer2.util
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classGlUtilextends[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.
OpenGL ES utilities.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | GlUtil.GlException |
Deprecated.
Thrown when an OpenGL error occurs. |
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int[] | EGL_CONFIG_ATTRIBUTES_RGBA_1010102 |
Deprecated.
|
| static int[] | EGL_CONFIG_ATTRIBUTES_RGBA_8888 |
Deprecated.
|
| static int | HOMOGENEOUS_COORDINATE_VECTOR_SIZE |
Deprecated.
Number of elements in a 3d homogeneous coordinate vector describing a vertex.
|
| static float | LENGTH_NDC |
Deprecated.
Length of the normalized device coordinate (NDC) space, which spans from -1 to 1. |
All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| static void | bindTexture(int textureTarget, int texId) |
Deprecated.
Binds the texture of the given type with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.
|
| static void | checkGlError() |
Deprecated.
Collects all OpenGL errors that occurred since this method was last called and throws a GlUtil.GlException with the combined error message.
|
| static void | checkGlException(boolean expression, String errorMessage) |
Deprecated.
Throws a GlUtil.GlException with the given message if expression evaluates to false.
|
| static void | clearOutputFrame() |
Deprecated.
Fills the pixels in the current output render target with (r=0, g=0, b=0, a=0).
|
| static float[] | create4x4IdentityMatrix() |
Deprecated.
Creates a 4x4 identity matrix.
|
| static FloatBuffer | createBuffer(float[] data) |
Deprecated.
Allocates a FloatBuffer with the given data.
|
| static EGLContext | createEglContext(EGLContext sharedContext, EGLDisplay eglDisplay, int openGlVersion, int[] configAttributes) |
Deprecated.
Creates a new EGLContext for the specified EGLDisplay.
|
| static EGLContext | createEglContext(EGLDisplay eglDisplay) |
Deprecated.
Creates a new EGLContext for the specified EGLDisplay.
|
| static EGLDisplay | createEglDisplay() |
Deprecated.
Returns an initialized default EGLDisplay.
|
| static EGLSurface | createEglSurface(EGLDisplay eglDisplay, Object surface, @com.google.android.exoplayer2.C.ColorTransfer int colorTransfer, boolean isEncoderInputSurface) |
Deprecated.
Creates a new EGLSurface wrapping the specified surface.
|
| static int | createExternalTexture() |
Deprecated.
Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.
|
| static int | createFboForTexture(int texId) |
Deprecated.
Returns a new framebuffer for the texture.
|
| static EGLSurface | createFocusedPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) |
Deprecated.
Creates and focuses a placeholder EGLSurface.
|
| static int | createTexture(int width, int height, boolean useHighPrecisionColorComponents) |
Deprecated.
Allocates a new RGBA texture with the specified dimensions and color component precision.
|
| static float[] | createVertexBuffer(List<float[]> vertexList) |
Deprecated.
Flattens the list of 4 element NDC coordinate vectors into a buffer.
|
| static void | deleteFbo(int fboId) |
Deprecated.
Deletes a framebuffer, or silently ignores the method call if fboId is unused.
|
| static void | deleteRbo(int rboId) |
Deprecated.
Deletes a renderbuffer, or silently ignores the method call if rboId is unused.
|
| static void | deleteTexture(int textureId) |
Deprecated.
Deletes a GL texture.
|
| static void | destroyEglContext(EGLDisplay eglDisplay, EGLContext eglContext) |
Deprecated.
Destroys the EGLContext identified by the provided EGLDisplay and EGLContext.
|
| static void | destroyEglSurface(EGLDisplay eglDisplay, EGLSurface eglSurface) |
Deprecated.
Destroys the EGLSurface identified by the provided EGLDisplay and EGLSurface.
|
| static void | focusEglSurface(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, int width, int height) |
Deprecated.
Makes the specified eglSurface the render target, using a viewport of width by height pixels.
|
| static void | focusFramebuffer(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, int framebuffer, int width, int height) |
Deprecated.
Makes the specified framebuffer the render target, using a viewport of width by height pixels.
|
| static void | focusFramebufferUsingCurrentContext(int framebuffer, int width, int height) |
Deprecated.
Makes the specified framebuffer the render target, using a viewport of width by height pixels.
|
| static EGLSurface | focusPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay) |
Deprecated.
Creates and focuses a placeholder EGLSurface.
|
| static EGLContext | getCurrentContext() |
Deprecated.
Gets the current context.
|
| static float[] | getNormalizedCoordinateBounds() |
Deprecated.
Bounds of normalized device coordinates, commonly used for defining viewport boundaries.
|
| static float[] | getTextureCoordinateBounds() |
Deprecated.
Typical bounds used for sampling from textures.
|
| static boolean | isBt2020PqExtensionSupported() |
Deprecated.
Returns whether EXTENSION_COLORSPACE_BT2020_PQ is supported.
|
| static boolean | isProtectedContentExtensionSupported(Context context) |
Deprecated.
Returns whether creating a GL context with EXTENSION_PROTECTED_CONTENT is possible.
|
| static boolean | isSurfacelessContextExtensionSupported() |
Deprecated.
Returns whether the EXTENSION_SURFACELESS_CONTEXT extension is supported.
|
| static boolean | isYuvTargetExtensionSupported() |
Deprecated.
Returns whether the EXTENSION_YUV_TARGET extension is supported.
|
| static void | setToIdentity(float[] matrix) |
Deprecated.
Sets the input matrix to an identity matrix.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int HOMOGENEOUS_COORDINATE_VECTOR_SIZE
Deprecated.
Number of elements in a 3d homogeneous coordinate vector describing a vertex. See Also:Constant Field Values
-
public static final float LENGTH_NDC
Deprecated.
Length of the normalized device coordinate (NDC) space, which spans from -1 to 1. See Also:Constant Field Values
-
public static final int[] EGL_CONFIG_ATTRIBUTES_RGBA_8888
Deprecated.
-
public static final int[] EGL_CONFIG_ATTRIBUTES_RGBA_1010102
Deprecated.
-
public static float[] getNormalizedCoordinateBounds()
Deprecated.
Bounds of normalized device coordinates, commonly used for defining viewport boundaries.
-
public static float[] getTextureCoordinateBounds()
Deprecated.
Typical bounds used for sampling from textures.
-
public static float[] create4x4IdentityMatrix()
Deprecated.
Creates a 4x4 identity matrix.
-
public static void setToIdentity(float[] matrix)
Deprecated.
Sets the input matrix to an identity matrix.
-
public static float[] createVertexBuffer([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<float[]> vertexList)
Deprecated.
Flattens the list of 4 element NDC coordinate vectors into a buffer.
-
public static boolean isProtectedContentExtensionSupported([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns whether creating a GL context with EXTENSION_PROTECTED_CONTENT is possible.
If true, the device supports a protected output path for DRM content when using GL.
-
public static boolean isSurfacelessContextExtensionSupported()
Deprecated.
Returns whether the EXTENSION_SURFACELESS_CONTEXT extension is supported.
This extension allows passing EGL14.EGL_NO_SURFACE for both the write and read surfaces in a call to EGL14.eglMakeCurrent(EGLDisplay, EGLSurface, EGLSurface, EGLContext).
-
public static boolean isYuvTargetExtensionSupported()
Deprecated.
Returns whether the EXTENSION_YUV_TARGET extension is supported.
This extension allows sampling raw YUV values from an external texture, which is required for HDR input.
-
public static boolean isBt2020PqExtensionSupported()
Deprecated.
Returns whether EXTENSION_COLORSPACE_BT2020_PQ is supported.
-
@RequiresApi(17)
public static[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")createEglDisplay()
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Returns an initialized default EGLDisplay.
Throws:GlUtil.GlException
-
@RequiresApi(17)
public static[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")createEglContext([EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html?is-external=true "class or interface in android.opengl")eglDisplay)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates a new EGLContext for the specified EGLDisplay.
Configures the EGLContext with EGL_CONFIG_ATTRIBUTES_RGBA_8888 and OpenGL ES 2.0.
Parameters:eglDisplay - The EGLDisplay to create an EGLContext for.Throws:GlUtil.GlException
-
@RequiresApi(17)
public static[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")createEglContext([EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html?is-external=true "class or interface in android.opengl")sharedContext,[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,
@IntRange(from=2L,to=3L)
int openGlVersion,
int[] configAttributes)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates a new EGLContext for the specified EGLDisplay.
Parameters:sharedContext - The EGLContext with which to share data.eglDisplay - The EGLDisplay to create an EGLContext for.openGlVersion - The version of OpenGL ES to configure. Accepts either 2, for OpenGL ES 2.0, or 3, for OpenGL ES 3.0.configAttributes - The attributes to configure EGL with. Accepts either EGL_CONFIG_ATTRIBUTES_RGBA_1010102, or EGL_CONFIG_ATTRIBUTES_RGBA_8888.Throws:GlUtil.GlException
-
@RequiresApi(17)
public static[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")createEglSurface([EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html?is-external=true "class or interface in android.opengl")eglDisplay,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")surface,
@com.google.android.exoplayer2.C.ColorTransfer int colorTransfer,
boolean isEncoderInputSurface)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates a new EGLSurface wrapping the specified surface.
The EGLSurface will configure with OpenGL ES 2.0.
Parameters:eglDisplay - The EGLDisplay to attach the surface to.surface - The surface to wrap; must be a surface, surface texture or surface holder.colorTransfer - The color transfer characteristics to which the surface is configured. The only accepted values are C.COLOR_TRANSFER_SDR, C.COLOR_TRANSFER_HLG and C.COLOR_TRANSFER_ST2084.isEncoderInputSurface - Whether the surface is the input surface of an encoder.Throws:GlUtil.GlException
-
@RequiresApi(17)
public static[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")focusPlaceholderEglSurface([EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html?is-external=true "class or interface in android.opengl")eglContext,[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates and focuses a placeholder EGLSurface.
This makes a EGLContext current when reading and writing to a surface is not required, configured with EGL_CONFIG_ATTRIBUTES_RGBA_8888.
Parameters:eglContext - The EGLContext to make current.eglDisplay - The EGLDisplay to attach the surface to.Returns:EGL14.EGL_NO_SURFACE if supported and a 1x1 pixel buffer surface otherwise.Throws:GlUtil.GlException
-
@RequiresApi(17)
public static[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")createFocusedPlaceholderEglSurface([EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html?is-external=true "class or interface in android.opengl")eglContext,[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,
int[] configAttributes)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates and focuses a placeholder EGLSurface.
This makes a EGLContext current when reading and writing to a surface is not required.
Parameters:eglContext - The EGLContext to make current.eglDisplay - The EGLDisplay to attach the surface to.configAttributes - The attributes to configure EGL with. Accepts EGL_CONFIG_ATTRIBUTES_RGBA_1010102 and EGL_CONFIG_ATTRIBUTES_RGBA_8888.Returns:A placeholder EGLSurface that has been focused to allow rendering to take place, or EGL14.EGL_NO_SURFACE if the current context supports rendering without a surface.Throws:GlUtil.GlException
-
public static[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")getCurrentContext()
Deprecated.
Gets the current context.
-
public static void checkGlError()
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Collects all OpenGL errors that occurred since this method was last called and throws a GlUtil.GlException with the combined error message.
Throws:GlUtil.GlException
-
public static void clearOutputFrame()
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Fills the pixels in the current output render target with (r=0, g=0, b=0, a=0).
Throws:GlUtil.GlException
-
@RequiresApi(17)
public static void focusEglSurface([EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")eglContext,[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")eglSurface,
int width,
int height)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Makes the specified eglSurface the render target, using a viewport of width by height pixels.
Throws:GlUtil.GlException
-
@RequiresApi(17)
public static void focusFramebuffer([EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")eglContext,[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")eglSurface,
int framebuffer,
int width,
int height)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Makes the specified framebuffer the render target, using a viewport of width by height pixels.
Throws:GlUtil.GlException
-
@RequiresApi(17)
public static void focusFramebufferUsingCurrentContext(int framebuffer,
int width,
int height)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Makes the specified framebuffer the render target, using a viewport of width by height pixels.
The caller must ensure that there is a current OpenGL context before calling this method.
Parameters:framebuffer - The identifier of the framebuffer object to bind as the output render target.width - The viewport width, in pixels.height - The viewport height, in pixels.Throws:GlUtil.GlException
-
public static[FloatBuffer](https://developer.android.com/reference/java/nio/FloatBuffer.html "class or interface in java.nio")createBuffer(float[] data)
Deprecated.
Allocates a FloatBuffer with the given data.
Parameters:data - Used to initialize the new buffer.
-
public static int createExternalTexture()
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.
Throws:GlUtil.GlException
-
public static int createTexture(int width,
int height,
boolean useHighPrecisionColorComponents)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Allocates a new RGBA texture with the specified dimensions and color component precision.
Parameters:width - The width of the new texture in pixels.height - The height of the new texture in pixels.useHighPrecisionColorComponents - If false, uses colors with 8-bit unsigned bytes. If true, use 16-bit (half-precision) floating-point.Returns:The texture identifier for the newly-allocated texture.Throws:GlUtil.GlException - If the texture allocation fails.
-
public static void bindTexture(int textureTarget,
int texId)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Binds the texture of the given type with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.
Parameters:textureTarget - The target to which the texture is bound, e.g. GLES20.GL_TEXTURE_2D for a two-dimensional texture or GLES11Ext.GL_TEXTURE_EXTERNAL_OES for an external texture.texId - The texture identifier.Throws:GlUtil.GlException
-
public static int createFboForTexture(int texId)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Returns a new framebuffer for the texture.
Parameters:texId - The identifier of the texture to attach to the framebuffer.Throws:GlUtil.GlException
-
public static void deleteTexture(int textureId)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Deletes a GL texture.
Parameters:textureId - The ID of the texture to delete.Throws:GlUtil.GlException
-
@RequiresApi(17)
public static void destroyEglContext(@Nullable[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,
@Nullable[EGLContext](https://developer.android.com/reference/android/opengl/EGLContext.html "class or interface in android.opengl")eglContext)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Destroys the EGLContext identified by the provided EGLDisplay and EGLContext.
Throws:GlUtil.GlException
-
@RequiresApi(17)
public static void destroyEglSurface(@Nullable[EGLDisplay](https://developer.android.com/reference/android/opengl/EGLDisplay.html "class or interface in android.opengl")eglDisplay,
@Nullable[EGLSurface](https://developer.android.com/reference/android/opengl/EGLSurface.html "class or interface in android.opengl")eglSurface)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Destroys the EGLSurface identified by the provided EGLDisplay and EGLSurface.
Throws:GlUtil.GlException
-
public static void deleteFbo(int fboId)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Deletes a framebuffer, or silently ignores the method call if fboId is unused.
Throws:GlUtil.GlException
-
public static void deleteRbo(int rboId)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Deletes a renderbuffer, or silently ignores the method call if rboId is unused.
Throws:GlUtil.GlException
-
public static void checkGlException(boolean expression,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")errorMessage)
throws[GlUtil.GlException](GlUtil.GlException.html "class in com.google.android.exoplayer2.util")
Deprecated.
Throws a GlUtil.GlException with the given message if expression evaluates to false.
Throws:GlUtil.GlException