Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Phudatkgkg opened this issue Dec 12, 2022 · 0 comments

Comments

@Phudatkgkg
Copy link

Phudatkgkg commented Dec 12, 2022

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; `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant