https://github.com/gpujs/expo-gl
A GPU.js extender for use with React Native's Expo library
https://github.com/gpujs/expo-gl
Last synced: 10 months ago
JSON representation
A GPU.js extender for use with React Native's Expo library
- Host: GitHub
- URL: https://github.com/gpujs/expo-gl
- Owner: gpujs
- Created: 2019-06-29T17:16:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T23:47:33.000Z (about 3 years ago)
- Last Synced: 2024-04-24T19:18:43.812Z (almost 2 years ago)
- Language: JavaScript
- Size: 98.6 KB
- Stars: 20
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @gpujs/expo-gl - A GPU.js extender for use with React Native's Expo library
This package allows you to use [GPU.js](gpu.rocks) with Expo to get a native GPGPU.
## Installation
1. Setup Expo - https://docs.expo.io/versions/latest/introduction/installation/
2. Add the following to use `@gpujs/expo-gl`:
```js
import { GLView } from 'expo-gl';
import { GPU } from '@gpujs/expo-gl';
GLView.createContextAsync()
.then(context => {
const gpu = new GPU({ context });
const kernel = gpu.createKernel(kernelFunctionHere, kernelOptionsHere);
kernel();
});
```
3. Visit https://github.com/gpujs/gpu.js for documentation on `kernelFunctionHere`, `kernelOptionsHere`, as well as the api.
4. Run your expo from Android or iOS and have native GPGPU support!
5. Have fun!
## Example
```js
import { GLView } from 'expo-gl';
import { GPU } from '@gpujs/expo-gl';
GLView.createContextAsync()
.then(context => {
const gpu = new GPU({ context });
const kernel = gpu.createKernel(function() {
return 1;
}, { output: [1], debug: true });
console.log(kernel());
gpu.destroy();
});
```