mirror of
https://github.com/gre/gl-react.git
synced 2026-02-01 17:27:08 +00:00
Fixes https://github.com/gre/gl-react/issues/131 Fixes https://github.com/gre/gl-react/issues/133 Fixes https://github.com/gre/gl-react/issues/146
21 lines
655 B
JavaScript
21 lines
655 B
JavaScript
import { WebGLView } from "react-native-webgl";
|
|
import { Surface } from "gl-react-native";
|
|
import { setRuntime } from "cookbook-rn-shared/lib/gl-react-implementation";
|
|
setRuntime({
|
|
name: "gl-react-native",
|
|
EXGLView: WebGLView,
|
|
Surface,
|
|
endFrame: gl => gl.getExtension("RN").endFrame(),
|
|
loadThreeJSTexture: (gl, src, texture, renderer) => {
|
|
var properties = renderer.properties.get(texture);
|
|
gl
|
|
.getExtension("RN")
|
|
.loadTexture({ yflip: true, image: src })
|
|
.then(({ texture }) => {
|
|
properties.__webglTexture = texture;
|
|
properties.__webglInit = true;
|
|
texture.needsUpdate = true;
|
|
});
|
|
}
|
|
});
|