@amazon-devices/expo-gl provides GLView that acts as an OpenGL ES render target and provides a GLContext.
On the mounting of a GLView, an OpenGL ES context is created. You should receive an 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, for example gl.clearColor. The library doesn’t natively provide a way to render an image for every frame, therefore other JS functions must be used for it, like 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 that are usable without a GLView for headless rendering. To learn more, see the documentation for createContextAsync and takeSnapshotAsync.
This library is system-deployed and available to React Native for Vega apps without a separate installation process. The library 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.

