# GlUtil

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/GlUtil.java+class:androidx.media3.common.util.GlUtil)

*** ** * ** ***


```
@UnstableApi
class GlUtil
```

<br />

*** ** * ** ***

OpenGL ES utilities.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException : https://developer.android.com/reference/java/lang/Exception.html` Thrown when an OpenGL error occurs. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_1010102()` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_8888()` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/ExperimentalApi https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#GL_FENCE_SYNC_UNSET() = -1` Marker value for when no fence sync is set. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#HOMOGENEOUS_COORDINATE_VECTOR_SIZE() = 4` Number of elements in a 3d homogeneous coordinate vector describing a vertex. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#LENGTH_NDC() = 2.0f` Length of the normalized device coordinate (NDC) space, which spans from -1 to 1. |

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#awaitSyncObject(long)(syncObject: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Ensures that following commands on the current OpenGL context will not be executed until the sync point has been reached. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#bindTexture(int,int,int)(textureTarget: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sampleFilter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Binds the texture of the given type with the specified MIN and MAG sampling filter and GL_CLAMP_TO_EDGE wrapping. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#blitFrameBuffer(int,androidx.media3.common.util.GlRect,int,androidx.media3.common.util.GlRect)( readFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, readRect: https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlRect!, drawFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, drawRect: https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlRect! )` Copies the pixels from `readFboId` into `drawFboId`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#checkEglException(java.lang.String)(errorMessage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Collects EGL errors that occurred in the last called EGL function and throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the combined error code. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#checkGlError()()` Collects all OpenGL errors that occurred since this method was last called and throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the combined error message. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#checkGlException(boolean,java.lang.String)(expression: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, errorMessage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the given message if `expression` evaluates to ` false`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#clearFocusedBuffers()()` Fills the pixels in the current output render target buffers with (r=0, g=0, b=0, a=0). |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#clearFocusedBuffersOpaque()()` Fills the pixels in the current output render target buffers with (r=0, g=0, b=0, a=1). |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#create4x4IdentityMatrix()()` Creates a 4x4 identity matrix. |
| `java-static https://developer.android.com/reference/java/nio/FloatBuffer.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createBuffer(float[])(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!)` Allocates a FloatBuffer with the given data. |
| `java-static https://developer.android.com/reference/android/opengl/EGLContext.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createEglContext(android.opengl.EGLDisplay)(eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!)` Creates a new `https://developer.android.com/reference/android/opengl/EGLContext.html` for the specified `https://developer.android.com/reference/android/opengl/EGLDisplay.html`. |
| `java-static https://developer.android.com/reference/android/opengl/EGLContext.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createEglContext(android.opengl.EGLContext,android.opengl.EGLDisplay,int,int[])( sharedContext: https://developer.android.com/reference/android/opengl/EGLContext.html!, eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!, openGlVersion: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 2, to = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, configAttributes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>! )` Creates a new `https://developer.android.com/reference/android/opengl/EGLContext.html` for the specified `https://developer.android.com/reference/android/opengl/EGLDisplay.html`. |
| `java-static https://developer.android.com/reference/android/opengl/EGLSurface.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createEglSurface(android.opengl.EGLDisplay,java.lang.Object,int,boolean)( eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!, surface: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer colorTransfer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, isEncoderInputSurface: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates a new `https://developer.android.com/reference/android/opengl/EGLSurface.html` wrapping the specified `surface`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createExternalTexture()()` Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFboForTexture(int)(texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a new framebuffer for the texture. |
| `java-static https://developer.android.com/reference/android/opengl/EGLSurface.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFocusedPlaceholderEglSurface(android.opengl.EGLContext,android.opengl.EGLDisplay)( eglContext: https://developer.android.com/reference/android/opengl/EGLContext.html!, eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html! )` Creates and focuses a placeholder `https://developer.android.com/reference/android/opengl/EGLSurface.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createGlSyncFence()()` Returns a newly created sync object and inserts it into the GL command stream. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createPixelBufferObject(int)(size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a pixel buffer object with a data store of the given size and usage `https://developer.android.com/reference/android/opengl/GLES30.html#GL_DYNAMIC_READ`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createRgb10A2Texture(int,int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Allocates a new `https://developer.android.com/reference/android/opengl/GLES20.html#GL_RGBA``https://developer.android.com/reference/android/opengl/GLES30.html#GL_RGB10_A2` texture with the specified dimensions. |
| `java-static https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createSyncFences(int)(count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates the requested number of native sync fences from the current OpenGL context. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createTexture(android.graphics.Bitmap)(bitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!)` Allocates a new texture, initialized with the `https://developer.android.com/reference/android/graphics/Bitmap.html` data and size. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createTexture(int,int,boolean)( width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, useHighPrecisionColorComponents: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Allocates a new RGBA texture with the specified dimensions and color component precision. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createVertexBuffer(java.util.List<float[]>)(vertexList: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!>!)` Flattens the list of 4 element NDC coordinate vectors into a buffer. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteBuffer(int)(bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Deletes a buffer object, or silently ignores the method call if `bufferId` is unused. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteFbo(int)(fboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Deletes a framebuffer, or silently ignores the method call if `fboId` is unused. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteRbo(int)(rboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Deletes a renderbuffer, or silently ignores the method call if `rboId` is unused. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteSyncObject(long)(syncObject: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Deletes the underlying native object. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteSyncObjectQuietly(long)(syncObject: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Releases the GL sync object if set, suppressing any error. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteTexture(int)(textureId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Deletes a GL texture. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#destroyEglContext(android.opengl.EGLDisplay,android.opengl.EGLContext)(eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html?, eglContext: https://developer.android.com/reference/android/opengl/EGLContext.html?)` Destroys the `https://developer.android.com/reference/android/opengl/EGLContext.html` identified by the provided `https://developer.android.com/reference/android/opengl/EGLDisplay.html` and `https://developer.android.com/reference/android/opengl/EGLContext.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#destroyEglSurface(android.opengl.EGLDisplay,android.opengl.EGLSurface)(eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html?, eglSurface: https://developer.android.com/reference/android/opengl/EGLSurface.html?)` Destroys the `https://developer.android.com/reference/android/opengl/EGLSurface.html` identified by the provided `https://developer.android.com/reference/android/opengl/EGLDisplay.html` and `https://developer.android.com/reference/android/opengl/EGLSurface.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusEglSurface(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int)( eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!, eglContext: https://developer.android.com/reference/android/opengl/EGLContext.html!, eglSurface: https://developer.android.com/reference/android/opengl/EGLSurface.html!, width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Makes the specified `eglSurface` the render target, using a viewport of `width` by `height` pixels. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebuffer(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int,int)( eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!, eglContext: https://developer.android.com/reference/android/opengl/EGLContext.html!, eglSurface: https://developer.android.com/reference/android/opengl/EGLSurface.html!, framebuffer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Makes the specified `framebuffer` the render target, using a viewport of `width` by `height` pixels. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebufferUsingCurrentContext(int,int,int)( framebuffer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Makes the specified `framebuffer` the render target, using a viewport of `width` by `height` pixels. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#generateTexture()()` Returns a new, unbound GL texture identifier. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#getContextMajorVersion()()` Returns the `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_CONTEXT_CLIENT_VERSION` of the current context. |
| `java-static https://developer.android.com/reference/android/opengl/EGLContext.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#getCurrentContext()()` Gets the current `https://developer.android.com/reference/android/opengl/EGLContext.html`. |
| `java-static https://developer.android.com/reference/android/opengl/EGLDisplay.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#getDefaultEglDisplay()()` Returns an initialized default `https://developer.android.com/reference/android/opengl/EGLDisplay.html`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#getNormalizedCoordinateBounds()()` Bounds of normalized device coordinates, commonly used for defining viewport boundaries. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#getTextureCoordinateBounds()()` Typical bounds used for sampling from textures. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isBt2020HlgExtensionSupported()()` Returns whether `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_COLORSPACE_BT2020_HLG()` is supported. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isBt2020PqExtensionSupported()()` Returns whether `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_COLORSPACE_BT2020_PQ()` is supported. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isColorTransferSupported(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer colorTransfer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns whether the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer` is supported. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isProtectedContentExtensionSupported(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Returns whether creating a GL context with `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_PROTECTED_CONTENT()` is possible. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isSurfacelessContextExtensionSupported()()` Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_SURFACELESS_CONTEXT()` extension is supported. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#isYuvTargetExtensionSupported()()` Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_YUV_TARGET()` extension is supported. |
| `java-static https://developer.android.com/reference/java/nio/ByteBuffer.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#mapPixelBufferObject(int,int)(bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Maps the pixel buffer object's data store of a given size and returns a `https://developer.android.com/reference/java/nio/ByteBuffer.html` of OpenGL managed memory. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#schedulePixelBufferRead(int,int,int,int)( readFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Reads pixel data from the `https://developer.android.com/reference/android/opengl/GLES20.html#GL_COLOR_ATTACHMENT0` attachment of a framebuffer into the data store of a pixel buffer object. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#setTexture(int,android.graphics.Bitmap)(texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!)` Sets the `texId` to contain the `https://developer.android.com/reference/android/graphics/Bitmap.html` data and size. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#setToIdentity(float[])(matrix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!)` Sets the input `matrix` to an identity matrix. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#terminate(android.opengl.EGLDisplay)(eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!)` Terminates the `https://developer.android.com/reference/android/opengl/EGLDisplay.html` connection. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#unmapPixelBufferObject(int)(bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Unmaps the pixel buffer object `bufferId`'s data store. |

## Constants

### EGL_CONFIG_ATTRIBUTES_RGBA_1010102

```
const val EGL_CONFIG_ATTRIBUTES_RGBA_1010102: Array<Int>!
```

### EGL_CONFIG_ATTRIBUTES_RGBA_8888

```
const val EGL_CONFIG_ATTRIBUTES_RGBA_8888: Array<Int>!
```

### GL_FENCE_SYNC_UNSET

```
@ExperimentalApi
const val GL_FENCE_SYNC_UNSET = -1: Long
```

Marker value for when no fence sync is set.

### HOMOGENEOUS_COORDINATE_VECTOR_SIZE

```
const val HOMOGENEOUS_COORDINATE_VECTOR_SIZE = 4: Int
```

Number of elements in a 3d homogeneous coordinate vector describing a vertex.

### LENGTH_NDC

```
const val LENGTH_NDC = 2.0f: Float
```

Length of the normalized device coordinate (NDC) space, which spans from -1 to 1.

## Public functions

### awaitSyncObject

```
java-static fun awaitSyncObject(syncObject: Long): Unit
```

Ensures that following commands on the current OpenGL context will not be executed until the sync point has been reached. If `syncObject` equals `#GL_FENCE_SYNC_UNSET`, this is a no-op. This method does not block the CPU.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### bindTexture

```
java-static fun bindTexture(textureTarget: Int, texId: Int, sampleFilter: Int): Unit
```

Binds the texture of the given type with the specified MIN and MAG sampling filter and GL_CLAMP_TO_EDGE wrapping.

| Parameters |
|---|---|
| `textureTarget: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The target to which the texture is bound, e.g. `https://developer.android.com/reference/android/opengl/GLES20.html#GL_TEXTURE_2D` for a two-dimensional texture or `https://developer.android.com/reference/android/opengl/GLES11Ext.html#GL_TEXTURE_EXTERNAL_OES` for an external texture. |
| `texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The texture identifier. |
| `sampleFilter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The texture sample filter for both `https://developer.android.com/reference/android/opengl/GLES20.html#GL_TEXTURE_MAG_FILTER` and `https://developer.android.com/reference/android/opengl/GLES20.html#GL_TEXTURE_MIN_FILTER`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### blitFrameBuffer

```
java-static fun blitFrameBuffer(
    readFboId: Int,
    readRect: GlRect!,
    drawFboId: Int,
    drawRect: GlRect!
): Unit
```

Copies the pixels from `readFboId` into `drawFboId`. Requires OpenGL ES 3.0.

When the input pixel region (given by `readRect`) doesn't have the same size as the output region (given by `drawRect`), this method uses `https://developer.android.com/reference/android/opengl/GLES20.html#GL_LINEAR` filtering to scale the image contents.

| Parameters |
|---|---|
| `readFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The framebuffer object to read from. |
| `readRect: https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlRect!` | The rectangular region of `readFboId` to read from. |
| `drawFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The framebuffer object to draw into. |
| `drawRect: https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlRect!` | The rectangular region of `drawFboId` to draw into. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### checkEglException

```
java-static fun checkEglException(errorMessage: String!): Unit
```

Collects EGL errors that occurred in the last called EGL function and throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the combined error code.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### checkGlError

```
java-static fun checkGlError(): Unit
```

Collects all OpenGL errors that occurred since this method was last called and throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the combined error message.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### checkGlException

```
java-static fun checkGlException(expression: Boolean, errorMessage: String!): Unit
```

Throws a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` with the given message if `expression` evaluates to `
false`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### clearFocusedBuffers

```
java-static fun clearFocusedBuffers(): Unit
```

Fills the pixels in the current output render target buffers with (r=0, g=0, b=0, a=0).

Buffers can be focused using `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusEglSurface(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int)` and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebufferUsingCurrentContext(int,int,int)`, `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebuffer(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int,int)`, and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFocusedPlaceholderEglSurface(android.opengl.EGLContext,android.opengl.EGLDisplay)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### clearFocusedBuffersOpaque

```
java-static fun clearFocusedBuffersOpaque(): Unit
```

Fills the pixels in the current output render target buffers with (r=0, g=0, b=0, a=1).

Buffers can be focused using `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusEglSurface(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int)` and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebufferUsingCurrentContext(int,int,int)`, `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebuffer(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int,int)`, and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFocusedPlaceholderEglSurface(android.opengl.EGLContext,android.opengl.EGLDisplay)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### create4x4IdentityMatrix

```
java-static fun create4x4IdentityMatrix(): Array<Float>!
```

Creates a 4x4 identity matrix.

### createBuffer

```
java-static fun createBuffer(data: FloatArray<Float>!): FloatBuffer!
```

Allocates a FloatBuffer with the given data.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | Used to initialize the new buffer. |

### createEglContext

```
java-static fun createEglContext(eglDisplay: EGLDisplay!): EGLContext!
```

Creates a new `https://developer.android.com/reference/android/opengl/EGLContext.html` for the specified `https://developer.android.com/reference/android/opengl/EGLDisplay.html`.

Configures the `https://developer.android.com/reference/android/opengl/EGLContext.html` with `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_8888()` and OpenGL ES 2.0.

| Parameters |
|---|---|
| `eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!` | The `https://developer.android.com/reference/android/opengl/EGLDisplay.html` to create an `https://developer.android.com/reference/android/opengl/EGLContext.html` for. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createEglContext

```
java-static fun createEglContext(
    sharedContext: EGLContext!,
    eglDisplay: EGLDisplay!,
    openGlVersion: @IntRange(from = 2, to = 3) Int,
    configAttributes: IntArray<Int>!
): EGLContext!
```

Creates a new `https://developer.android.com/reference/android/opengl/EGLContext.html` for the specified `https://developer.android.com/reference/android/opengl/EGLDisplay.html`.

| Parameters |
|---|---|
| `sharedContext: https://developer.android.com/reference/android/opengl/EGLContext.html!` | The `https://developer.android.com/reference/android/opengl/EGLContext.html` with which to share data. |
| `eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!` | The `https://developer.android.com/reference/android/opengl/EGLDisplay.html` to create an `https://developer.android.com/reference/android/opengl/EGLContext.html` for. |
| `openGlVersion: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 2, to = 3) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The version of OpenGL ES to configure. Accepts either `2`, for OpenGL ES 2.0, or `3`, for OpenGL ES 3.0. |
| `configAttributes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The attributes to configure EGL with. Accepts either `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_1010102()`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_8888()`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createEglSurface

```
java-static fun createEglSurface(
    eglDisplay: EGLDisplay!,
    surface: Any!,
    @C.ColorTransfer colorTransfer: Int,
    isEncoderInputSurface: Boolean
): EGLSurface!
```

Creates a new `https://developer.android.com/reference/android/opengl/EGLSurface.html` wrapping the specified `surface`.

The `https://developer.android.com/reference/android/opengl/EGLSurface.html` will configure with OpenGL ES 2.0.

| Parameters |
|---|---|
| `eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!` | The `https://developer.android.com/reference/android/opengl/EGLDisplay.html` to attach the surface to. |
| `surface: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | The surface to wrap; must be a surface, surface texture or surface holder. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer colorTransfer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer` to which the `surface` is configured. The only accepted values are `https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_SDR()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_GAMMA_2_2()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_SRGB()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_HLG()`, and `https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_ST2084()`. Value is one of the following: - `Format.NO_VALUE` <br /> |
| `isEncoderInputSurface: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the `surface` is the input surface of an encoder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createExternalTexture

```
java-static fun createExternalTexture(): Int
```

Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createFboForTexture

```
java-static fun createFboForTexture(texId: Int): Int
```

Returns a new framebuffer for the texture.

| Parameters |
|---|---|
| `texId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The identifier of the texture to attach to the framebuffer. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createFocusedPlaceholderEglSurface

```
java-static fun createFocusedPlaceholderEglSurface(
    eglContext: EGLContext!,
    eglDisplay: EGLDisplay!
): EGLSurface!
```

Creates and focuses a placeholder `https://developer.android.com/reference/android/opengl/EGLSurface.html`.

This makes a `https://developer.android.com/reference/android/opengl/EGLContext.html` current when reading and writing to a surface is not required, configured with `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_8888()`.

| Parameters |
|---|---|
| `eglContext: https://developer.android.com/reference/android/opengl/EGLContext.html!` | The `https://developer.android.com/reference/android/opengl/EGLContext.html` to make current. |
| `eglDisplay: https://developer.android.com/reference/android/opengl/EGLDisplay.html!` | The `https://developer.android.com/reference/android/opengl/EGLDisplay.html` to attach the surface to. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/opengl/EGLSurface.html!` | `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_NO_SURFACE` if supported and a 1x1 pixel buffer surface otherwise. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createGlSyncFence

```
java-static fun createGlSyncFence(): Long
```

Returns a newly created sync object and inserts it into the GL command stream.

Returns `0` if the operation failed, no `https://developer.android.com/reference/android/opengl/EGLContext.html``https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFocusedPlaceholderEglSurface(android.opengl.EGLContext,android.opengl.EGLDisplay)`, or the focused `https://developer.android.com/reference/android/opengl/EGLContext.html` version is less than 3.0.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createPixelBufferObject

```
java-static fun createPixelBufferObject(size: Int): Int
```

Creates a pixel buffer object with a data store of the given size and usage `https://developer.android.com/reference/android/opengl/GLES30.html#GL_DYNAMIC_READ`.

The buffer is suitable for repeated modification by OpenGL and reads by the application.

| Parameters |
|---|---|
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of the buffer object's data store. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The pixel buffer object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### createRgb10A2Texture

```
java-static fun createRgb10A2Texture(width: Int, height: Int): Int
```

Allocates a new `https://developer.android.com/reference/android/opengl/GLES20.html#GL_RGBA``https://developer.android.com/reference/android/opengl/GLES30.html#GL_RGB10_A2` texture with the specified dimensions.

Normalized integers in textures are automatically converted for floating point numbers https://www.khronos.org/opengl/wiki/Normalized_Integer

The only supported pixel data type for the `https://developer.android.com/reference/android/opengl/GLES30.html#GL_RGB10_A2` sized internal format is `https://developer.android.com/reference/android/opengl/GLES30.html#GL_UNSIGNED_INT_2_10_10_10_REV`. See https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml

The created texture is not zero-initialized. To clear the texture, `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebuffer(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int,int)` on the texture and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#clearFocusedBuffers()` its content.

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the new texture in pixels. |
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the new texture in pixels. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The texture identifier for the newly-allocated texture. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` | If the texture allocation fails. |

### createSyncFences

```
java-static fun createSyncFences(count: Int): ImmutableList<SyncFenceWrapper!>!
```

Creates the requested number of native sync fences from the current OpenGL context.

Inserts a sync fence command into the GL command stream. The returned sync fences will signal when the GPU reaches the fence command in the stream - meaning all OpenGL operations enqueued on the current context before this call have completed execution on the GPU.

Must be called on the thread that owns the current OpenGL context.

| Parameters |
|---|---|
| `count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of fences to generate. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper!>!` | A list of `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper` instances, or an empty list if native sync fences are unsupported on this device or the API level is less than 33. If an empty list is returned, `glFinish()` is called to ensure synchronization. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` | If creating or duplicating the sync fence fails. |

### createTexture

```
java-static fun createTexture(bitmap: Bitmap!): Int
```

Allocates a new texture, initialized with the `https://developer.android.com/reference/android/graphics/Bitmap.html` data and size.

| Parameters |
|---|---|
| `bitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!` | The `https://developer.android.com/reference/android/graphics/Bitmap.html` for which the texture is created. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The texture identifier for the newly-allocated texture. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` | If the texture allocation fails. |

### createTexture

```
java-static fun createTexture(
    width: Int,
    height: Int,
    useHighPrecisionColorComponents: Boolean
): Int
```

Allocates a new RGBA texture with the specified dimensions and color component precision.

The created texture is not zero-initialized. To clear the texture, `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#focusFramebuffer(android.opengl.EGLDisplay,android.opengl.EGLContext,android.opengl.EGLSurface,int,int,int)` on the texture and `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#clearFocusedBuffers()` its content.

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The width of the new texture in pixels. |
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The height of the new texture in pixels. |
| `useHighPrecisionColorComponents: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If `false`, uses colors with 8-bit unsigned bytes. If `true`, use 16-bit (half-precision) floating-point. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The texture identifier for the newly-allocated texture. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` | If the texture allocation fails. |

### createVertexBuffer

```
java-static fun createVertexBuffer(vertexList: (Mutable)List<FloatArray<Float>!>!): Array<Float>!
```

Flattens the list of 4 element NDC coordinate vectors into a buffer.

### deleteBuffer

```
java-static fun deleteBuffer(bufferId: Int): Unit
```

Deletes a buffer object, or silently ignores the method call if `bufferId` is unused.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### deleteFbo

```
java-static fun deleteFbo(fboId: Int): Unit
```

Deletes a framebuffer, or silently ignores the method call if `fboId` is unused.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### deleteRbo

```
java-static fun deleteRbo(rboId: Int): Unit
```

Deletes a renderbuffer, or silently ignores the method call if `rboId` is unused.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### deleteSyncObject

```
java-static fun deleteSyncObject(syncObject: Long): Unit
```

Deletes the underlying native object.

The `syncObject` must not be used after deletion.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### deleteSyncObjectQuietly

```
java-static fun deleteSyncObjectQuietly(syncObject: Long): Unit
```

Releases the GL sync object if set, suppressing any error.

### deleteTexture

```
java-static fun deleteTexture(textureId: Int): Unit
```

Deletes a GL texture.

| Parameters |
|---|---|
| `textureId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The ID of the texture to delete. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### destroyEglContext

```
java-static fun destroyEglContext(eglDisplay: EGLDisplay?, eglContext: EGLContext?): Unit
```

Destroys the `https://developer.android.com/reference/android/opengl/EGLContext.html` identified by the provided `https://developer.android.com/reference/android/opengl/EGLDisplay.html` and `https://developer.android.com/reference/android/opengl/EGLContext.html`.

This is a no-op if called on already-destroyed `https://developer.android.com/reference/android/opengl/EGLDisplay.html` and `https://developer.android.com/reference/android/opengl/EGLContext.html` instances.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### destroyEglSurface

```
java-static fun destroyEglSurface(eglDisplay: EGLDisplay?, eglSurface: EGLSurface?): Unit
```

Destroys the `https://developer.android.com/reference/android/opengl/EGLSurface.html` identified by the provided `https://developer.android.com/reference/android/opengl/EGLDisplay.html` and `https://developer.android.com/reference/android/opengl/EGLSurface.html`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### focusEglSurface

```
java-static fun focusEglSurface(
    eglDisplay: EGLDisplay!,
    eglContext: EGLContext!,
    eglSurface: EGLSurface!,
    width: Int,
    height: Int
): Unit
```

Makes the specified `eglSurface` the render target, using a viewport of `width` by `height` pixels.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### focusFramebuffer

```
java-static fun focusFramebuffer(
    eglDisplay: EGLDisplay!,
    eglContext: EGLContext!,
    eglSurface: EGLSurface!,
    framebuffer: Int,
    width: Int,
    height: Int
): Unit
```

Makes the specified `framebuffer` the render target, using a viewport of `width` by `height` pixels.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### focusFramebufferUsingCurrentContext

```
java-static fun focusFramebufferUsingCurrentContext(
    framebuffer: Int,
    width: Int,
    height: Int
): Unit
```

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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The identifier of the framebuffer object to bind as the output render target. |
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The viewport width, in pixels. |
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The viewport height, in pixels. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### generateTexture

```
java-static fun generateTexture(): Int
```

Returns a new, unbound GL texture identifier.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### getContextMajorVersion

```
java-static fun getContextMajorVersion(): Long
```

Returns the `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_CONTEXT_CLIENT_VERSION` of the current context.

Returns `0` if no `https://developer.android.com/reference/android/opengl/EGLContext.html``https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createFocusedPlaceholderEglSurface(android.opengl.EGLContext,android.opengl.EGLDisplay)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### getCurrentContext

```
java-static fun getCurrentContext(): EGLContext!
```

Gets the current `https://developer.android.com/reference/android/opengl/EGLContext.html`.

### getDefaultEglDisplay

```
java-static fun getDefaultEglDisplay(): EGLDisplay!
```

Returns an initialized default `https://developer.android.com/reference/android/opengl/EGLDisplay.html`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### getNormalizedCoordinateBounds

```
java-static fun getNormalizedCoordinateBounds(): Array<Float>!
```

Bounds of normalized device coordinates, commonly used for defining viewport boundaries.

### getTextureCoordinateBounds

```
java-static fun getTextureCoordinateBounds(): Array<Float>!
```

Typical bounds used for sampling from textures.

### isBt2020HlgExtensionSupported

```
java-static fun isBt2020HlgExtensionSupported(): Boolean
```

Returns whether `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_COLORSPACE_BT2020_HLG()` is supported.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### isBt2020PqExtensionSupported

```
java-static fun isBt2020PqExtensionSupported(): Boolean
```

Returns whether `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_COLORSPACE_BT2020_PQ()` is supported.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### isColorTransferSupported

```
java-static fun isColorTransferSupported(@C.ColorTransfer colorTransfer: Int): Boolean
```

Returns whether the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer` is supported.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### isProtectedContentExtensionSupported

```
java-static fun isProtectedContentExtensionSupported(context: Context!): Boolean
```

Returns whether creating a GL context with `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_PROTECTED_CONTENT()` is possible.

If `true`, the device supports a protected output path for DRM content when using GL.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### isSurfacelessContextExtensionSupported

```
java-static fun isSurfacelessContextExtensionSupported(): Boolean
```

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_SURFACELESS_CONTEXT()` extension is supported.

This extension allows passing `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_NO_SURFACE` for both the write and read surfaces in a call to `https://developer.android.com/reference/android/opengl/EGL14.html#eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### isYuvTargetExtensionSupported

```
java-static fun isYuvTargetExtensionSupported(): Boolean
```

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#EXTENSION_YUV_TARGET()` extension is supported.

This extension allows sampling raw YUV values from an external texture, which is required for HDR input.

### mapPixelBufferObject

```
java-static fun mapPixelBufferObject(bufferId: Int, size: Int): ByteBuffer!
```

Maps the pixel buffer object's data store of a given size and returns a `https://developer.android.com/reference/java/nio/ByteBuffer.html` of OpenGL managed memory.

The application must not write into the returned `https://developer.android.com/reference/java/nio/ByteBuffer.html`.

The pixel buffer object should have a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#schedulePixelBufferRead(int,int,int,int)`.

When the application no longer needs to access the returned buffer, call `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#unmapPixelBufferObject(int)`.

This call blocks until the pixel buffer data from the last `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#schedulePixelBufferRead(int,int,int,int)` call is available.

| Parameters |
|---|---|
| `bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The pixel buffer object. |
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of the pixel buffer object's data store to be mapped. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/nio/ByteBuffer.html!` | The `https://developer.android.com/reference/java/nio/ByteBuffer.html` that holds pixel data. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### schedulePixelBufferRead

```
java-static fun schedulePixelBufferRead(
    readFboId: Int,
    width: Int,
    height: Int,
    bufferId: Int
): Unit
```

Reads pixel data from the `https://developer.android.com/reference/android/opengl/GLES20.html#GL_COLOR_ATTACHMENT0` attachment of a framebuffer into the data store of a pixel buffer object.

The texture backing the color attachment of `readFboId` and the buffer store of `
bufferId` must hold an image of the given `width` and `height` with format `https://developer.android.com/reference/android/opengl/GLES20.html#GL_RGBA` and type `https://developer.android.com/reference/android/opengl/GLES20.html#GL_UNSIGNED_BYTE`.

This a non-blocking call which reads the data asynchronously.

HDR support is not yet implemented.

| Parameters |
|---|---|
| `readFboId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The framebuffer that holds pixel data. |
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The image width. |
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The image height. |
| `bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The pixel buffer object to read into. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### setTexture

```
java-static fun setTexture(texId: Int, bitmap: Bitmap!): Unit
```

Sets the `texId` to contain the `https://developer.android.com/reference/android/graphics/Bitmap.html` data and size.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### setToIdentity

```
java-static fun setToIdentity(matrix: FloatArray<Float>!): Unit
```

Sets the input `matrix` to an identity matrix.

### terminate

```
java-static fun terminate(eglDisplay: EGLDisplay!): Unit
```

Terminates the `https://developer.android.com/reference/android/opengl/EGLDisplay.html` connection.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### unmapPixelBufferObject

```
java-static fun unmapPixelBufferObject(bufferId: Int): Unit
```

Unmaps the pixel buffer object `bufferId`'s data store.

The pixel buffer object should be previously `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#mapPixelBufferObject(int,int)`.

After this method returns, accessing data inside a previously `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#mapPixelBufferObject(int,int)``https://developer.android.com/reference/java/nio/ByteBuffer.html` results in undefined behaviour.

When this method returns, the pixel buffer object `bufferId` can be reused by `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#schedulePixelBufferRead(int,int,int,int)`.

| Parameters |
|---|---|
| `bufferId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The pixel buffer object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |