Hello, I have been struggling with this one for a while. I want to capture images by the camera using expo camera and render them as texture and so far all I am getting is a black texture or an error. here is the current code
const captureImage = async () => {
if (cameraRef.current) {
const photo = await cameraRef.current.takePictureAsync({
base64: true,
shutterSound: false,
skipProcessing: true,
});
return photo?.uri;
}
function ImageT({ src }: { src: string }) {
try {
const texture = useLoader(TextureLoader, src as string);
console.log(texture);
return (
<mesh>
<planeGeometry attach="geometry" args={[2, 2]} />
<meshBasicMaterial
side={THREE.DoubleSide}
attach="material"
map={texture}
/>
</mesh>
);
} catch (e) {
console.log(e);
return null;
}
}