# Gles2WatchFaceService.Engine

Summary:[Ctors](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine#pubctors)\|[Methods](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine#inhmethods)  

# Gles2WatchFaceService.Engine

`
public


class
Gles2WatchFaceService.Engine
`  
`


``


``

extends `[WatchFaceService.Engine](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html)`


``


`

|---|---|---|-----------------------------------------------------------------|
| [java.lang.Object](http://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [android.service.wallpaper.WallpaperService.Engine](http://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html) |||
|   | ↳ | [android.support.wearable.watchface.WatchFaceService.Engine](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html) ||
|   |   | ↳ | android.support.wearable.watchface.Gles2WatchFaceService.Engine |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
Use[Watch Face Format](https://developer.android.com/training/wearables/wff)APIs instead.

The actual implementation of a watch face that draws using OpenGL ES 2.0. You must implement[Gles2WatchFaceService.onCreateEngine()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.html#onCreateEngine())to return your concrete Engine implementation.

## Summary

|                                                          ### Public constructors                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Engine](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#Engine())`() ` |

|                                                                                                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[EGLConfig](http://developer.android.com/reference/android/opengl/EGLConfig.html)   | ` `[chooseEglConfig](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#chooseEglConfig(android.opengl.EGLDisplay))`(`[EGLDisplay](http://developer.android.com/reference/android/opengl/EGLDisplay.html)` eglDisplay) ` Returns the desired EGL config to use.                                                                                                                                                                                                                                                                                                     |
| ` `[EGLContext](http://developer.android.com/reference/android/opengl/EGLContext.html) | ` `[createEglContext](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#createEglContext(android.opengl.EGLDisplay,%20android.opengl.EGLConfig))`(`[EGLDisplay](http://developer.android.com/reference/android/opengl/EGLDisplay.html)` eglDisplay, `[EGLConfig](http://developer.android.com/reference/android/opengl/EGLConfig.html)` eglConfig) ` Creates the EGL context and returns it.                                                                                                                                                                       |
| ` `[EGLSurface](http://developer.android.com/reference/android/opengl/EGLSurface.html) | ` `[createWindowSurface](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#createWindowSurface(android.opengl.EGLDisplay,%20android.opengl.EGLConfig,%20android.view.SurfaceHolder))`(`[EGLDisplay](http://developer.android.com/reference/android/opengl/EGLDisplay.html)` eglDisplay, `[EGLConfig](http://developer.android.com/reference/android/opengl/EGLConfig.html)` eglConfig, `[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` surfaceHolder) ` Creates and returns a new EGL window surface for`surfaceHolder`. |
| ` `[EGLDisplay](http://developer.android.com/reference/android/opengl/EGLDisplay.html) | ` `[initializeEglDisplay](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#initializeEglDisplay())`() ` Initializes the display.                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` final void`                                                                          | ` `[invalidate](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#invalidate())`() ` Schedules a call to[onDraw()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDraw())to draw the next frame.                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                | ` `[onApplyWindowInsets](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onApplyWindowInsets(android.view.WindowInsets))`(`[WindowInsets](http://developer.android.com/reference/android/view/WindowInsets.html)` insets) `                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                | ` `[onCreate](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onCreate(android.view.SurfaceHolder))`(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` surfaceHolder) `                                                                                                                                                                                                                                                                                                                                                  |
| ` void`                                                                                | ` `[onDestroy](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDestroy())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                | ` `[onDraw](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDraw())`() ` Draws the watch face.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` void`                                                                                | ` `[onGlContextCreated](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onGlContextCreated())`() ` Called when a new GL context is created.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                | ` `[onGlSurfaceCreated](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onGlSurfaceCreated(int,%20int))`(int width, int height) ` Called when a new GL surface is created.                                                                                                                                                                                                                                                                                                                                                                                       |
| ` final void`                                                                          | ` `[onSurfaceChanged](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onSurfaceChanged(android.view.SurfaceHolder,%20int,%20int,%20int))`(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` holder, int format, int width, int height) `                                                                                                                                                                                                                                                                                 |
| ` final void`                                                                          | ` `[onSurfaceDestroyed](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onSurfaceDestroyed(android.view.SurfaceHolder))`(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` holder) `                                                                                                                                                                                                                                                                                                                                     |
| ` final void`                                                                          | ` `[onSurfaceRedrawNeeded](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onSurfaceRedrawNeeded(android.view.SurfaceHolder))`(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` holder) `                                                                                                                                                                                                                                                                                                                               |
| ` final void`                                                                          | ` `[postInvalidate](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#postInvalidate())`() ` Posts a message to schedule a call to[onDraw()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDraw())to draw the next frame.                                                                                                                                                                                                                                                                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.support.wearable.watchface.WatchFaceService.Engine](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html)` ` |------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` final int`                                                                       | ` `[getInterruptionFilter](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#getInterruptionFilter())`() ` Returns interruption filter selected by the user.                                                                                                                                                                                                                                                     | | ` final int`                                                                       | ` `[getNotificationCount](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#getNotificationCount())`() ` Returns the total number of notification cards in the stream.                                                                                                                                                                                                                                           | | ` final `[Rect](http://developer.android.com/reference/android/graphics/Rect.html) | ` `[getPeekCardPosition](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#getPeekCardPosition())`() ` *This method is deprecated. Wear 2.0 doesn't have peeking cards*                                                                                                                                                                                                                                          | | ` final int`                                                                       | ` `[getUnreadCount](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#getUnreadCount())`() ` Returns the number of unread notification cards in the stream.                                                                                                                                                                                                                                                      | | ` final boolean`                                                                   | ` `[isInAmbientMode](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#isInAmbientMode())`() ` Returns whether the watch face is in ambient mode.                                                                                                                                                                                                                                                                | | ` void`                                                                            | ` `[onAmbientModeChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onAmbientModeChanged(boolean))`(boolean inAmbientMode) ` Called when the device enters or exits ambient mode.                                                                                                                                                                                                                        | | ` `[Bundle](http://developer.android.com/reference/android/os/Bundle.html)         | ` `[onCommand](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onCommand(java.lang.String,%20int,%20int,%20int,%20android.os.Bundle,%20boolean))`(`[String](http://developer.android.com/reference/java/lang/String.html)` action, int x, int y, int z, `[Bundle](http://developer.android.com/reference/android/os/Bundle.html)` extras, boolean resultRequested) `                                           | | ` void`                                                                            | ` `[onComplicationDataUpdate](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onComplicationDataUpdate(int,%20android.support.wearable.complications.ComplicationData))`(int watchFaceComplicationId, `[ComplicationData](https://developer.android.com/reference/android/support/wearable/complications/ComplicationData.html)` data) ` Called when new complication data is received.                        | | ` void`                                                                            | ` `[onCreate](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onCreate(android.view.SurfaceHolder))`(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` holder) `                                                                                                                                                                                                       | | ` void`                                                                            | ` `[onDestroy](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onDestroy())`() `                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                            | ` `[onInterruptionFilterChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onInterruptionFilterChanged(int))`(int interruptionFilter) ` Called when the user changes interruption filter.                                                                                                                                                                                                                | | ` void`                                                                            | ` `[onNotificationCountChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onNotificationCountChanged(int))`(int count) ` Called when the total number of notification cards in the stream has changed.                                                                                                                                                                                                   | | ` void`                                                                            | ` `[onPeekCardPositionUpdate](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onPeekCardPositionUpdate(android.graphics.Rect))`(`[Rect](http://developer.android.com/reference/android/graphics/Rect.html)` rect) ` *This method is deprecated. Wear 2.0 doesn't have peeking cards*                                                                                                                           | | ` void`                                                                            | ` `[onPropertiesChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onPropertiesChanged(android.os.Bundle))`(`[Bundle](http://developer.android.com/reference/android/os/Bundle.html)` properties) ` Called when the properties of the device are determined.                                                                                                                                             | | ` void`                                                                            | ` `[onTapCommand](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onTapCommand(int,%20int,%20int,%20long))`(int tapType, int x, int y, long eventTime) ` Called when a tap or touch related event occurs.                                                                                                                                                                                                      | | ` void`                                                                            | ` `[onTimeTick](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onTimeTick())`() ` Called periodically to update the time shown by the watch face.                                                                                                                                                                                                                                                             | | ` void`                                                                            | ` `[onTouchEvent](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onTouchEvent(android.view.MotionEvent))`(`[MotionEvent](http://developer.android.com/reference/android/view/MotionEvent.html)` event) ` *This method is deprecated. Do not use this to receive touch events on a watch face.*                                                                                                                | | ` void`                                                                            | ` `[onUnreadCountChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onUnreadCountChanged(int))`(int count) ` Called when the number of unread notification cards in the stream has changed.                                                                                                                                                                                                              | | ` void`                                                                            | ` `[onVisibilityChanged](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#onVisibilityChanged(boolean))`(boolean visible) ` Called to inform you of the watch face becoming visible or hidden.                                                                                                                                                                                                                  | | ` void`                                                                            | ` `[setActiveComplications](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#setActiveComplications(int...))`(int... watchFaceComplicationIds) ` Sets the complications which are active in the watchface.                                                                                                                                                                                                      | | ` void`                                                                            | ` `[setDefaultComplicationProvider](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#setDefaultComplicationProvider(int,%20android.content.ComponentName,%20int))`(int watchFaceComplicationId, `[ComponentName](http://developer.android.com/reference/android/content/ComponentName.html)` provider, int type) ` Sets a custom provider as the default provider for the specified watch face complication id. | | ` void`                                                                            | ` `[setDefaultSystemComplicationProvider](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#setDefaultSystemComplicationProvider(int,%20int,%20int))`(int watchFaceComplicationId, int systemProvider, int type) ` Sets a system provider as the default provider for the specified watch face complication id.                                                                                                  | | ` void`                                                                            | ` `[setTouchEventsEnabled](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#setTouchEventsEnabled(boolean))`(boolean enabled) ` *This method is deprecated.*                                                                                                                                                                                                                                                    | | ` void`                                                                            | ` `[setWatchFaceStyle](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine.html#setWatchFaceStyle(android.support.wearable.watchface.WatchFaceStyle))`(`[WatchFaceStyle](https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceStyle.html)` watchFaceStyle) ` Sets the watch face style.                                                                                                  | ||
| From class` `[android.service.wallpaper.WallpaperService.Engine](http://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html)` ` |--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                    | ` dump(`[String](http://developer.android.com/reference/java/lang/String.html)` arg0, `[FileDescriptor](http://developer.android.com/reference/java/io/FileDescriptor.html)` arg1, `[PrintWriter](http://developer.android.com/reference/java/io/PrintWriter.html)` arg2, `[String[]](http://developer.android.com/reference/java/lang/String.html)` arg3) ` | | ` int`                                                                                     | ` getDesiredMinimumHeight() `                                                                                                                                                                                                                                                                                                                                | | ` int`                                                                                     | ` getDesiredMinimumWidth() `                                                                                                                                                                                                                                                                                                                                 | | ` `[Context](http://developer.android.com/reference/android/content/Context.html)          | ` getDisplayContext() `                                                                                                                                                                                                                                                                                                                                      | | ` `[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html) | ` getSurfaceHolder() `                                                                                                                                                                                                                                                                                                                                       | | ` boolean`                                                                                 | ` isPreview() `                                                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                 | ` isVisible() `                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                    | ` notifyColorsChanged() `                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                    | ` onApplyWindowInsets(`[WindowInsets](http://developer.android.com/reference/android/view/WindowInsets.html)` arg0) `                                                                                                                                                                                                                                        | | ` `[Bundle](http://developer.android.com/reference/android/os/Bundle.html)                 | ` onCommand(`[String](http://developer.android.com/reference/java/lang/String.html)` arg0, int arg1, int arg2, int arg3, `[Bundle](http://developer.android.com/reference/android/os/Bundle.html)` arg4, boolean arg5) `                                                                                                                                     | | ` WallpaperColors`                                                                         | ` onComputeColors() `                                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                    | ` onCreate(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` arg0) `                                                                                                                                                                                                                                                 | | ` void`                                                                                    | ` onDesiredSizeChanged(int arg0, int arg1) `                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                    | ` onDestroy() `                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                    | ` onOffsetsChanged(float arg0, float arg1, float arg2, float arg3, int arg4, int arg5) `                                                                                                                                                                                                                                                                     | | ` void`                                                                                    | ` onSurfaceChanged(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` arg0, int arg1, int arg2, int arg3) `                                                                                                                                                                                                           | | ` void`                                                                                    | ` onSurfaceCreated(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` arg0) `                                                                                                                                                                                                                                         | | ` void`                                                                                    | ` onSurfaceDestroyed(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` arg0) `                                                                                                                                                                                                                                       | | ` void`                                                                                    | ` onSurfaceRedrawNeeded(`[SurfaceHolder](http://developer.android.com/reference/android/view/SurfaceHolder.html)` arg0) `                                                                                                                                                                                                                                    | | ` void`                                                                                    | ` onTouchEvent(`[MotionEvent](http://developer.android.com/reference/android/view/MotionEvent.html)` arg0) `                                                                                                                                                                                                                                                 | | ` void`                                                                                    | ` onVisibilityChanged(boolean arg0) `                                                                                                                                                                                                                                                                                                                        | | ` void`                                                                                    | ` onZoomChanged(float arg0) `                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                    | ` setOffsetNotificationsEnabled(boolean arg0) `                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                    | ` setTouchEventsEnabled(boolean arg0) `                                                                                                                                                                                                                                                                                                                      | ||
| From class` `[java.lang.Object](http://developer.android.com/reference/java/lang/Object.html)` ` |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` `[Object](http://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                               | | ` boolean`                                                                         | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                            | ` finalize() `                                                                            | | ` final `[Class](http://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                            | | ` int`                                                                             | ` hashCode() `                                                                            | | ` final void`                                                                      | ` notify() `                                                                              | | ` final void`                                                                      | ` notifyAll() `                                                                           | | ` `[String](http://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                            | | ` final void`                                                                      | ` wait(long arg0, int arg1) `                                                             | | ` final void`                                                                      | ` wait(long arg0) `                                                                       | | ` final void`                                                                      | ` wait() `                                                                                | ||

## Public constructors

### Engine

```
public Engine ()
```

<br />

<br />

## Public methods

### chooseEglConfig

```
public EGLConfig chooseEglConfig (EGLDisplay eglDisplay)
```

Returns the desired EGL config to use. By default, uses a config that:

- supports OpenGL ES 2.0 contexts
- has at least 8 bits for each of red, green, blue, and alpha

If there are multiple matches, the one with the most bits for red, green, blue, and alpha is chosen.

Watch faces can override this method to call[EGL14.eglChooseConfig(EGLDisplay, int[], int, EGLConfig[], int, int, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglChooseConfig(android.opengl.EGLDisplay,%20int[],%20int,%20android.opengl.EGLConfig[],%20int,%20int,%20int[],%20int))with different attributes. By passing in a large array,`eglChooseConfig`can return multiple matching configs and the watch face can choose among them by using[EGL14.eglGetConfigAttrib(EGLDisplay, EGLConfig, int, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglGetConfigAttrib(android.opengl.EGLDisplay,%20android.opengl.EGLConfig,%20int,%20int[],%20int))to fetch their attributes.

<br />

|                        Parameters                         ||
|--------------|---------------------------------------------|
| `eglDisplay` | `EGLDisplay`: the EGL display to use <br /> |

|                                                     Returns                                                     ||
|-----------------------------------------------------------------------------------|------------------------------|
| [EGLConfig](http://developer.android.com/reference/android/opengl/EGLConfig.html) | the EGL config to use <br /> |

### createEglContext

```
public EGLContext createEglContext (EGLDisplay eglDisplay, 
                EGLConfig eglConfig)
```

Creates the EGL context and returns it. By default, creates an EGL 2.0 context using[EGL14.eglCreateContext(EGLDisplay, EGLConfig, EGLContext, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglCreateContext(android.opengl.EGLDisplay,%20android.opengl.EGLConfig,%20android.opengl.EGLContext,%20int[],%20int)).

Watch faces can override this method to call[EGL14.eglCreateContext(EGLDisplay, EGLConfig, EGLContext, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglCreateContext(android.opengl.EGLDisplay,%20android.opengl.EGLConfig,%20android.opengl.EGLContext,%20int[],%20int))with different attributes.

<br />

|            Parameters             ||
|--------------|---------------------|
| `eglDisplay` | `EGLDisplay` <br /> |
| `eglConfig`  | `EGLConfig` <br />  |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| [EGLContext](http://developer.android.com/reference/android/opengl/EGLContext.html) | <br /> |

### createWindowSurface

```
public EGLSurface createWindowSurface (EGLDisplay eglDisplay, 
                EGLConfig eglConfig, 
                SurfaceHolder surfaceHolder)
```

Creates and returns a new EGL window surface for`surfaceHolder`. By default, this surface has no attributes.

Watch faces can override this method to call[EGL14.eglCreateWindowSurface(EGLDisplay, EGLConfig, Object, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglCreateWindowSurface(android.opengl.EGLDisplay,%20android.opengl.EGLConfig,%20java.lang.Object,%20int[],%20int))with different attributes.

<br />

|               Parameters                ||
|-----------------|------------------------|
| `eglDisplay`    | `EGLDisplay` <br />    |
| `eglConfig`     | `EGLConfig` <br />     |
| `surfaceHolder` | `SurfaceHolder` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| [EGLSurface](http://developer.android.com/reference/android/opengl/EGLSurface.html) | <br /> |

### initializeEglDisplay

```
public EGLDisplay initializeEglDisplay ()
```

Initializes the display. Calls[EGL14.eglGetDisplay(int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglGetDisplay(int))and[EGL14.eglInitialize(EGLDisplay, int[], int, int[], int)](http://developer.android.com/reference/android/opengl/EGL14.html#eglInitialize(android.opengl.EGLDisplay,%20int[],%20int,%20int[],%20int)).

<br />

|                                                            Returns                                                            ||
|-------------------------------------------------------------------------------------|------------------------------------------|
| [EGLDisplay](http://developer.android.com/reference/android/opengl/EGLDisplay.html) | the initialized EGLDisplay to use <br /> |

### invalidate

```
public final void invalidate ()
```

Schedules a call to[onDraw()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDraw())to draw the next frame. Must be called on the main thread.

<br />

### onApplyWindowInsets

```
public void onApplyWindowInsets (WindowInsets insets)
```

<br />

<br />

|           Parameters            ||
|----------|-----------------------|
| `insets` | `WindowInsets` <br /> |

### onCreate

```
public void onCreate (SurfaceHolder surfaceHolder)
```

<br />

<br />

|               Parameters                ||
|-----------------|------------------------|
| `surfaceHolder` | `SurfaceHolder` <br /> |

### onDestroy

```
public void onDestroy ()
```

<br />

<br />

### onDraw

```
public void onDraw ()
```

Draws the watch face. It's safe to use GL APIs in this method.

<br />

### onGlContextCreated

```
public void onGlContextCreated ()
```

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

<br />

### onGlSurfaceCreated

```
public void onGlSurfaceCreated (int width, 
                int height)
```

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

<br />

|                     Parameters                      ||
|----------|-------------------------------------------|
| `width`  | `int`: width of surface in pixels <br />  |
| `height` | `int`: height of surface in pixels <br /> |

### onSurfaceChanged

```
public final void onSurfaceChanged (SurfaceHolder holder, 
                int format, 
                int width, 
                int height)
```

<br />

<br />

|            Parameters            ||
|----------|------------------------|
| `holder` | `SurfaceHolder` <br /> |
| `format` | `int` <br />           |
| `width`  | `int` <br />           |
| `height` | `int` <br />           |

### onSurfaceDestroyed

```
public final void onSurfaceDestroyed (SurfaceHolder holder)
```

<br />

<br />

|            Parameters            ||
|----------|------------------------|
| `holder` | `SurfaceHolder` <br /> |

### onSurfaceRedrawNeeded

```
public final void onSurfaceRedrawNeeded (SurfaceHolder holder)
```

<br />

<br />

|            Parameters            ||
|----------|------------------------|
| `holder` | `SurfaceHolder` <br /> |

### postInvalidate

```
public final void postInvalidate ()
```

Posts a message to schedule a call to[onDraw()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#onDraw())to draw the next frame. Unlike[invalidate()](https://developer.android.com/reference/android/support/wearable/watchface/Gles2WatchFaceService.Engine.html#invalidate()), this method is thread-safe and may be called on any thread.

<br />