@amazon-devices/expo-gl provides GLView that acts as an OpenGL ES render target and provides a GLContext.
On mounting of GLView, an OpenGL ES context is created. It should receive a onContextCreate function, which takes a gl object. This gl object is the core way of interacting with OpenGL - with the use of JSI, expo-gl creates methods on the gl object that correspond to webgl API methods, e.g. gl.clearColor. It doesn’t natively provide a way to render an image every frame and other JS functions must be used for it (e.g. setInterval). GLView’s drawing buffer is presented as the contents of the View every frame indicated by calling the endFrameEXP method. Methods suffixed with EXP are expo-gl’s extensions.
ExpoGL also provides static methods (i.e. usable without a GLView) for headless rendering - see documentation for createContextAsync and takeSnapshotAsync.
This is a system-deployed library and is available to React Native for Vega apps without a separate installation process. It is deployed as an autolinking library which your app links to at runtime. Compatibility is guaranteed only between the library and the version of React Native for Vega for which it is built.
Installation
-
Add the JavaScript library dependency in the
package.jsonfile. -
Reinstall dependencies using
npm installcommand.
Examples
API reference
Check out the dedicated documentation page for info about this library, API reference and more: Official Expo documentation for expo-gl.Components
GLView props
Methods
Implementation details
The@amazon-devices/expo-gl library on Vega doesn’t support the following methods: createCameraTextureAsync and startARSessionAsync.

