@amazon-devices/expo-gl provides a GLView that acts as an OpenGL ES render target and provides a GLContext.
When GLView mounts, it creates an OpenGL ES context. Pass an onContextCreate function that receives a gl object. This gl object is the primary way to interact with OpenGL. Using JSI, expo-gl creates methods on the gl object that correspond to WebGL API methods, such as gl.clearColor. The library doesn’t provide a built-in way to render an image every frame, so you must use other JS functions (such as setInterval). The GLView drawing buffer presents as the contents of the View every frame when you call the endFrameEXP method. Methods suffixed with EXP are expo-gl extensions.
ExpoGL also provides static methods (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
Known issues and limitations
The@amazon-devices/expo-gl library on Vega doesn’t support the following methods: createCameraTextureAsync and startARSessionAsync.

