# Renderer.GlesRenderer

Artifact: [androidx.wear.watchface:watchface](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/Renderer.kt+class:androidx.wear.watchface.Renderer.GlesRenderer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

*** ** * ** ***


```
abstract class Renderer.GlesRenderer : Renderer
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.wear.watchface.Renderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer) ||
|   | ↳ | [androidx.wear.watchface.Renderer.GlesRenderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer) |

Known direct subclasses [ListenableGlesRenderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer), [Renderer.GlesRenderer2](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer2)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` | **This class is deprecated.** Use ListenableGlesRenderer2 instead |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

Known indirect subclasses [ListenableGlesRenderer2](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer2)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer2` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> GlesRenderer is deprecated, use this instead:
>
> ```kotlin
> GlesRenderer2
> ```

Watch faces that require `https://developer.android.com/reference/android/opengl/GLES20.html` rendering should extend their `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer` from this class or `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer2` if they can take advantage of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.SharedAssets` to save memory when editing (there can be more than once WatchFace instance when editing).

A GlesRenderer is expected to be constructed on the background thread associated with `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService#getBackgroundThreadHandler()` inside a call to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService#createWatchFace(android.view.SurfaceHolder,androidx.wear.watchface.WatchState,androidx.wear.watchface.ComplicationSlotsManager,androidx.wear.watchface.style.CurrentUserStyleRepository)`. All rendering is be done on the UiThread. There is a memory barrier between construction and rendering so no special threading primitives are required.

Two linked `https://developer.android.com/reference/android/opengl/EGLContext.html`s are created `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglBackgroundThreadContext()` and `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglUiThreadContext()` which are associated with background and UiThread respectively and are shared by all instances of the renderer. OpenGL objects created on (e.g. shaders and textures) can be used on the other.

If you need to make any OpenGl calls outside of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)`, `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onBackgroundThreadGlContextCreated()` or `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onUiThreadGlSurfaceCreated(kotlin.Int,kotlin.Int)` then you must use either `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0)` or `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0)` to execute a `https://developer.android.com/reference/java/lang/Runnable.html` inside of the corresponding context. Access to the GL contexts this way is necessary because GL contexts are not shared between renderers and there can be multiple watch face instances existing concurrently (e.g. headless and interactive, potentially from different watch faces if an APK contains more than one `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService`). In addition most drivers do not support concurrent access.

In Java it may be easier to extend `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` instead.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer.GlesException : https://developer.android.com/reference/java/lang/Exception.html` **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread [GlesRenderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#GlesRenderer(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Long,kotlin.IntArray,kotlin.IntArray,kotlin.IntArray))( surfaceHolder: https://developer.android.com/reference/android/view/SurfaceHolder.html, currentUserStyleRepository: https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository, watchState: https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchState, interactiveDrawModeUpdateDelayMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 60000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, eglConfigAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html, eglSurfaceAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html, eglContextAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html )` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public functions |
|---|---|
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread [onBackgroundThreadGlContextCreated](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onBackgroundThreadGlContextCreated())()` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper [onDestroy](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onDestroy())()` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onDump](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onDump(java.io.PrintWriter))(writer: https://developer.android.com/reference/java/io/PrintWriter.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread [onUiThreadGlSurfaceCreated](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onUiThreadGlSurfaceCreated(kotlin.Int,kotlin.Int))(width: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread [render](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime))(zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread [renderHighlightLayer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#renderHighlightLayer(java.time.ZonedDateTime))(zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread [runBackgroundThreadGlCommands](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0))(commands: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[runUiThreadGlCommands](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0))(commands: suspend () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` **This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/android/opengl/EGLContext.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglBackgroundThreadContext()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/android/opengl/EGLConfig.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglConfig()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/android/opengl/EGLDisplay.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglDisplay()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/android/opengl/EGLContext.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#eglUiThreadContext()` **This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

### Inherited functions

From [androidx.wear.watchface.Renderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer) `open https://developer.android.com/reference/android/graphics/Rect.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
[getMainClockElementBounds](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#getMainClockElementBounds())()`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
[invalidate](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#invalidate())()`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
[onRenderParametersChanged](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#onRenderParametersChanged(androidx.wear.watchface.RenderParameters))(renderParameters: https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters)`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[postInvalidate](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#postInvalidate())()`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[sendPreviewImageNeedsUpdateRequest](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#sendPreviewImageNeedsUpdateRequest())()`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
[shouldAnimate](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#shouldAnimate())()`

**This function is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.

### Inherited properties

From [androidx.wear.watchface.Renderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, https://developer.android.com/reference/kotlin/androidx/wear/watchface/ContentDescriptionLabel>>` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#additionalContentDescriptionLabels()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`@https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#centerX()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`@https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#centerY()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 60000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#interactiveDrawModeUpdateDelayMillis()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#renderParameters()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://developer.android.com/reference/android/graphics/Rect.html` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#screenBounds()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://developer.android.com/reference/android/view/SurfaceHolder.html` `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#surfaceHolder()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.
`https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceColors?` `@https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceExperimental
https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#watchfaceColors()`

**This property is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead.

## Public constructors

### GlesRenderer

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
@WorkerThread
[GlesRenderer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#GlesRenderer(android.view.SurfaceHolder,androidx.wear.watchface.style.CurrentUserStyleRepository,androidx.wear.watchface.WatchState,kotlin.Long,kotlin.IntArray,kotlin.IntArray,kotlin.IntArray))(
    surfaceHolder: SurfaceHolder,
    currentUserStyleRepository: CurrentUserStyleRepository,
    watchState: WatchState,
    interactiveDrawModeUpdateDelayMillis: @IntRange(from = 0, to = 60000) Long,
    eglConfigAttribList: IntArray = EGL_CONFIG_ATTRIB_LIST,
    eglSurfaceAttribList: IntArray = EGL_SURFACE_ATTRIB_LIST,
    eglContextAttribList: IntArray = EGL_CONTEXT_ATTRIB_LIST
)
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Constructs a `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer`, it is recommended that new code uses `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer2` instead.

| Parameters |
|---|---|
| `surfaceHolder: https://developer.android.com/reference/android/view/SurfaceHolder.html` | The `https://developer.android.com/reference/android/view/SurfaceHolder.html` whose `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)` will draw into. |
| `currentUserStyleRepository: https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository` | The associated `https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository`. |
| `watchState: https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchState` | The associated `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchState`. |
| `interactiveDrawModeUpdateDelayMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 60000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The interval in milliseconds between frames in interactive `https://developer.android.com/reference/kotlin/androidx/wear/watchface/DrawMode`s. To render at 60hz set to 16. Note when battery is low, the frame rate will be clamped to 10fps. Watch faces are recommended to use lower frame rates if possible for better battery life. Variable frame rates can also help preserve battery life, e.g. if a watch face has a short animation once per second it can adjust the frame rate inorder to sleep when not animating. |
| `eglConfigAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html = EGL_CONFIG_ATTRIB_LIST` | Attributes for `https://developer.android.com/reference/android/opengl/EGL14.html#eglChooseConfig(android.opengl.EGLDisplay, int[], int, android.opengl.EGLConfig[], int, int, int[], int)`. By default this selects an RGBA8888 back buffer. |
| `eglSurfaceAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html = EGL_SURFACE_ATTRIB_LIST` | The attributes to be passed to `https://developer.android.com/reference/android/opengl/EGL14.html#eglCreateWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.lang.Object, int[], int)`. By default this is empty. |
| `eglContextAttribList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html = EGL_CONTEXT_ATTRIB_LIST` | The attributes to be passed to `https://developer.android.com/reference/android/opengl/EGL14.html#eglCreateContext(android.opengl.EGLDisplay, android.opengl.EGLConfig, android.opengl.EGLContext, int[], int)`. By default this selects `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_CONTEXT_CLIENT_VERSION` 2. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer.GlesException` | If any GL calls fail during initialization. |

## Public functions

### onBackgroundThreadGlContextCreated

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
@WorkerThread
open suspend fun [onBackgroundThreadGlContextCreated](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onBackgroundThreadGlContextCreated())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called once a background thread when a new GL context is created on the background thread, before any subsequent calls to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)`. Note this function is called inside a lambda passed to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0)` which has synchronized access to the GL context.

If you need to override this method in java, consider using `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` instead.

### onDestroy

```
@CallSuper
open fun [onDestroy](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onDestroy())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when the Renderer is destroyed.

### onDump

```
open fun [onDump](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onDump(java.io.PrintWriter))(writer: PrintWriter): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when adb shell dumpsys is invoked for the WatchFaceService, allowing the renderer to optionally record state for debugging purposes.

### onUiThreadGlSurfaceCreated

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
@UiThread
open suspend fun [onUiThreadGlSurfaceCreated](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onUiThreadGlSurfaceCreated(kotlin.Int,kotlin.Int))(width: @Px Int, height: @Px Int): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called when a new GL surface is created on the UiThread, before any subsequent calls to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)` or in response to `https://developer.android.com/reference/android/view/SurfaceHolder.Callback.html#surfaceChanged(android.view.SurfaceHolder, int, int, int)`. Note this function is called inside a lambda passed to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0)` which has synchronized access to the GL context.

If you need to override this method in java, consider using `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` instead.

| Parameters |
|---|---|
| `width: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | width of surface in pixels |
| `height: @https://developer.android.com/reference/kotlin/androidx/annotation/Px https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | height of surface in pixels |

### render

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
@UiThread
abstract fun [render](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime))(zonedDateTime: ZonedDateTime): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Sub-classes should override this to implement their watch face rendering logic which should respect the current `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#renderParameters()`. Please note `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchState#isAmbient()` may not match the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters#drawMode()` and should not be used to decide what to render. E.g. when editing from the companion phone while the watch is ambient, renders may be requested with `https://developer.android.com/reference/kotlin/androidx/wear/watchface/DrawMode#INTERACTIVE`.

Any highlights due to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters#highlightLayer()` should be rendered by `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#renderHighlightLayer(java.time.ZonedDateTime)` instead where possible. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Note this function is called inside a lambda passed to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0)` which has synchronized access to the GL context.

Note also `GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ZERO)` is called by the library before this method.

Before any calls to this function `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onBackgroundThreadGlContextCreated()` and `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#onUiThreadGlSurfaceCreated(kotlin.Int,kotlin.Int)` will have been called once on their respective threads.

| Parameters |
|---|---|
| `zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html` | The zonedDateTime `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |

### renderHighlightLayer

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
@UiThread
abstract fun [renderHighlightLayer](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#renderHighlightLayer(java.time.ZonedDateTime))(zonedDateTime: ZonedDateTime): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Sub-classes should override this to implement their watch face highlight layer rendering logic for the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters#highlightLayer()` aspect of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer#renderParameters()`. Typically the implementation will clear the buffer to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters.HighlightLayer#backgroundTint()` before rendering a transparent highlight or a solid outline around the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/RenderParameters.HighlightLayer#highlightedElement()`. This will be composited as needed on top of the results of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#render(java.time.ZonedDateTime)`. For correct behavior this function must use the supplied `https://developer.android.com/reference/java/time/ZonedDateTime.html` in favor of any other ways of getting the time.

Note this function is called inside a lambda passed to `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0)` which has synchronized access to the GL context.

Note also `GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ZERO)` is called by the library before this method.

| Parameters |
|---|---|
| `zonedDateTime: https://developer.android.com/reference/java/time/ZonedDateTime.html` | The zonedDateTime `https://developer.android.com/reference/java/time/ZonedDateTime.html` to render with |

### runBackgroundThreadGlCommands

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
@WorkerThread
suspend fun [runBackgroundThreadGlCommands](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0))(commands: suspend () -> Unit): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Inside of a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-mutex/index.html` this function sets the GL context associated with the `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService#getBackgroundThreadHandler()`'s looper thread as the current one, executes `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0)` and finally unsets the GL context.

Access to the GL context this way is necessary because GL contexts are not shared between renderers and there can be multiple watch face instances existing concurrently (e.g. headless and interactive, potentially from different watch faces if an APK contains more than one `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService`).

NB this function is called by the library before running `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runBackgroundThreadGlCommands(kotlin.coroutines.SuspendFunction0)` so there's no need to use this directly in client code unless you need to make GL calls outside of those methods. If you need to call this method from java, consider using `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` which provides an overload taking a `https://developer.android.com/reference/java/lang/Runnable.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the calls to `https://developer.android.com/reference/android/opengl/EGL14.html#eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext)` fails |

### runUiThreadGlCommands

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
suspend fun [runUiThreadGlCommands](https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0))(commands: suspend () -> Unit): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Inside of a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-mutex/index.html` this function sets the UiThread GL context as the current one, executes `https://developer.android.com/reference/kotlin/androidx/wear/watchface/Renderer.GlesRenderer#runUiThreadGlCommands(kotlin.coroutines.SuspendFunction0)` and finally unsets the GL context.

Access to the GL context this way is necessary because GL contexts are not shared between renderers and there can be multiple watch face instances existing concurrently (e.g. headless and interactive, potentially from different watch faces if an APK contains more than one `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService`).

If you need to call this method from java, consider using `https://developer.android.com/reference/kotlin/androidx/wear/watchface/ListenableGlesRenderer` which provides an overload taking a `https://developer.android.com/reference/java/lang/Runnable.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the calls to `https://developer.android.com/reference/android/opengl/EGL14.html#eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext)` fails |

## Public properties

### eglBackgroundThreadContext

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
val eglBackgroundThreadContext: EGLContext
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The GlesRenderer's background Thread `https://developer.android.com/reference/android/opengl/EGLContext.html`.

### eglConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
var eglConfig: EGLConfig
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The GlesRenderer's `https://developer.android.com/reference/android/opengl/EGLConfig.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | setEglConfig is unsupported. |

### eglDisplay

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
var eglDisplay: EGLDisplay
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The GlesRenderer's `https://developer.android.com/reference/android/opengl/EGLDisplay.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | setEglDisplay is unsupported. |

### eglUiThreadContext

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
val eglUiThreadContext: EGLContext
```

> [!CAUTION]
> **This property is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

The GlesRenderer's UiThread `https://developer.android.com/reference/android/opengl/EGLContext.html`. Note this not available until after `https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFaceService#createWatchFace(android.view.SurfaceHolder,androidx.wear.watchface.WatchState,androidx.wear.watchface.ComplicationSlotsManager,androidx.wear.watchface.style.CurrentUserStyleRepository)` has completed.