# GLRenderer.EGLContextCallback

Artifact: [androidx.graphics:graphics-core](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/opengl/GLRenderer.kt+class:androidx.graphics.opengl.GLRenderer.EGLContextCallback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

*** ** * ** ***


```
public interface GLRenderer.EGLContextCallback
```

<br />

*** ** * ** ***

Callbacks invoked when the GL dependencies are created and destroyed. These are logical places to setup and tear down any dependencies that are used for drawing content within a frame (ex. compiling shaders)

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/graphics/opengl/GLRenderer.EGLContextCallback#onEGLContextCreated(androidx.graphics.opengl.egl.EGLManager)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLManager eglManager)` Callback invoked on the backing thread after EGL dependencies are initialized. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/graphics/opengl/GLRenderer.EGLContextCallback#onEGLContextDestroyed(androidx.graphics.opengl.egl.EGLManager)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLManager eglManager)` Callback invoked on the backing thread before EGL dependencies are about to be torn down. |

## Public methods

### onEGLContextCreated

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@WorkerThread
abstract void onEGLContextCreated(@NonNull EGLManager eglManager)
```

Callback invoked on the backing thread after EGL dependencies are initialized. This is guaranteed to be invoked before any instance of `https://developer.android.com/reference/androidx/graphics/opengl/GLRenderer.RenderCallback#onSurfaceCreated(androidx.graphics.opengl.egl.EGLSpec,android.opengl.EGLConfig,android.view.Surface,kotlin.Int,kotlin.Int)` is called. This will be invoked after `https://developer.android.com/reference/androidx/graphics/opengl/GLRenderer#start(kotlin.String)`.

### onEGLContextDestroyed

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@WorkerThread
abstract void onEGLContextDestroyed(@NonNull EGLManager eglManager)
```

Callback invoked on the backing thread before EGL dependencies are about to be torn down. This is invoked after `https://developer.android.com/reference/androidx/graphics/opengl/GLRenderer#stop(kotlin.Boolean,kotlin.Function1)` is processed.