Google is committed to advancing racial equity for Black communities. See how.

GlesRenderer

abstract class GlesRenderer : Renderer
kotlin.Any
   ↳ androidx.wear.watchface.Renderer
   ↳ androidx.wear.watchface.GlesRenderer

Watch faces that require GLES20 rendering should extend their Renderer from this class.

Summary

Public constructors
<init>(surfaceHolder: SurfaceHolder, userStyleRepository: UserStyleRepository, watchState: WatchState, eglConfigAttribList: IntArray = EGL_CONFIG_ATTRIB_LIST, eglSurfaceAttribList: IntArray = EGL_SURFACE_ATTRIB_LIST)

Watch faces that require GLES20 rendering should extend their Renderer from this class.

Public methods
open Unit

Called when the Renderer is destroyed.

open Unit

Called when a new GL context is created.

open Unit
onGlSurfaceCreated(width: Int, height: Int)

Called when a new GL surface is created.

abstract Unit
render(calendar: Calendar)

Sub-classes should override this to implement their rendering logic which should respect the current DrawMode.

Inherited functions
Inherited properties

Public constructors

<init>

GlesRenderer(
    surfaceHolder: SurfaceHolder,
    userStyleRepository: UserStyleRepository,
    watchState: WatchState,
    eglConfigAttribList: IntArray = EGL_CONFIG_ATTRIB_LIST,
    eglSurfaceAttribList: IntArray = EGL_SURFACE_ATTRIB_LIST)

Watch faces that require GLES20 rendering should extend their Renderer from this class.

Public methods

onDestroy

@CallSuper open fun onDestroy(): Unit

Called when the Renderer is destroyed.

onGlContextCreated

@UiThread open fun onGlContextCreated(): Unit

Called when a new GL context is created. It's safe to use GL APIs in this method.

onGlSurfaceCreated

@UiThread open fun onGlSurfaceCreated(
    width: Int,
    height: Int
): Unit

Called when a new GL surface is created. It's safe to use GL APIs in this method.

Parameters
width: Int width of surface in pixels
height: Int height of surface in pixels

render

@UiThread abstract fun render(calendar: Calendar): Unit

Sub-classes should override this to implement their rendering logic which should respect the current DrawMode. For correct functioning watch faces must use the supplied Calendar and avoid using any other ways of getting the time.

Parameters
calendar: Calendar The current Calendar