expo/expo-three

Possible Unhandled Promise Rejection (id: 0): ReferenceError: Can't find variable: BoxBufferGeometry

Phudatkgkg opened this issue · 0 comments

image_2022-12-13_000454462
i'm trying to make a simple cube using Three but it dosen't show on the mobile scene

`import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { ExpoWebGLRenderingContext, GLView } from 'expo-gl';
import ExpoTHREE, { Renderer } from 'expo-three';
import { Screen, Mesh, MeshBasicMaterial, PerspectiveCamera, Scene, } from 'three';
import { THREE } from 'expo-three';

const ThreeD = (props) => {
const onContextCreate = async (gl) => {
const scene = new Scene();
const camera = new PerspectiveCamera(
45,
gl.drawingBufferWidth / gl.drawingBufferHeight,
1,
1000
)

    gl.canvas = { width: gl.drawingBufferWidth, height: gl.drawingBufferHeight }
    const renderer = new Renderer({ gl })
    renderer.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight)

    const geometry = new BoxBufferGeometry(1, 1, 1)
    const material = new MeshBasicMaterial({
        color: 'blue'
    })

    const cube = new Mesh(geometry, material)
    scene.add(cube)
    const render = () => {
        requestAnimationFrame(render)
        renderer.render(scene, camera)
        gl.endFrameEXP()
    }
    render()
    return cube
}
return (
    <GLView
        style={styles.GLView}
        onContextCreate={onContextCreate}
    />
);

}

const styles = StyleSheet.create({
GLView: {
width: 500,
height: 500,
backgroundColor: "#90ff90"
},

});

export default ThreeD; `