DefaultGlObjectsProvider
@UnstableApi
public final class DefaultGlObjectsProvider implements GlObjectsProvider
Implementation of GlObjectsProvider that configures an EGLContext to share data with a preexisting sharedEglContext.
The created EGLContext is configured with 8-bit RGB or 10-bit RGB attributes and no depth buffer or render buffers.
Summary
Public constructors |
|---|
|
Creates an instance with no shared EGL context. |
DefaultGlObjectsProvider(@Nullable EGLContext sharedEglContext)Creates an instance with the specified shared EGL context. |
Public methods |
|
|---|---|
GlTextureInfo |
createBuffersForTexture(int texId, int width, int height)Returns a |
EGLContext |
createEglContext(Creates a new |
EGLSurface |
createEglSurface(Creates a new |
EGLSurface |
createFocusedPlaceholderEglSurface(Creates and focuses a placeholder |
void |
release(EGLDisplay eglDisplay)Releases the created objects. |
Public constructors
DefaultGlObjectsProvider
public DefaultGlObjectsProvider()
Creates an instance with no shared EGL context.
DefaultGlObjectsProvider
public DefaultGlObjectsProvider(@Nullable EGLContext sharedEglContext)
Creates an instance with the specified shared EGL context.
| Parameters | |
|---|---|
@Nullable EGLContext sharedEglContext |
The context with which to share data, or |
Public methods
createBuffersForTexture
public GlTextureInfo createBuffersForTexture(int texId, int width, int height)
Returns a GlTextureInfo containing the identifiers of the newly created buffers.
| Parameters | |
|---|---|
int texId |
The identifier of the texture to attach to the buffers. |
int width |
The width of the texture in pixels. |
int height |
The height of the texture in pixels. |
| Throws | |
|---|---|
androidx.media3.common.util.GlUtil.GlException |
If an error occurs during creation. |
createEglContext
public EGLContext createEglContext(
EGLDisplay eglDisplay,
int openGlVersion,
int[] configAttributes
)
Creates a new EGLContext for the specified EGLDisplay.
| Parameters | |
|---|---|
EGLDisplay eglDisplay |
The |
int openGlVersion |
The version of OpenGL ES to configure. Accepts either |
int[] configAttributes |
The attributes to configure EGL with. |
| Throws | |
|---|---|
androidx.media3.common.util.GlUtil.GlException |
If an error occurs during creation. |
createEglSurface
public EGLSurface createEglSurface(
EGLDisplay eglDisplay,
Object surface,
@C.ColorTransfer int colorTransfer,
boolean isEncoderInputSurface
)
Creates a new EGLSurface wrapping the specified surface.
| Parameters | |
|---|---|
EGLDisplay eglDisplay |
The |
Object surface |
The surface to wrap; must be a surface, surface texture or surface holder. |
@C.ColorTransfer int colorTransfer |
The |
boolean isEncoderInputSurface |
Whether the |
| Throws | |
|---|---|
androidx.media3.common.util.GlUtil.GlException |
If an error occurs during creation. |
createFocusedPlaceholderEglSurface
public EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext,
EGLDisplay eglDisplay
)
Creates and focuses a placeholder EGLSurface.
| Parameters | |
|---|---|
EGLContext eglContext |
The |
EGLDisplay eglDisplay |
The |
| Returns | |
|---|---|
EGLSurface |
A placeholder |
| Throws | |
|---|---|
androidx.media3.common.util.GlUtil.GlException |
If an error occurs during creation. |
release
public void release(EGLDisplay eglDisplay)
Releases the created objects.
| Parameters | |
|---|---|
EGLDisplay eglDisplay |
The |