[Vuejs]-Getting three.js screenshot gives error "'modelViewMatrix' is a read-only and non-configurable data"

0👍

It has been resolved.
It is basically VUE3 issue. You can fix it by few steps.

import { getCurrentInstance } from 'vue'

then inside you class:

this.instance = getCurrentInstance();
const { proxy } = this.instance;
proxy.$scene = new THREE.Scene();

then in snapShot you can do it like

snapShot() {
        const camera = this.camera;
        if(!camera) return;
        const scene = this.instance.proxy.$scene;
        const strMime = "image/png";    // "image/png" "image/jpeg"
        const renderer = this.renderer;
        renderer.render(scene, camera);
        const canvas = this.renderer.domElement;
        return canvas.toDataURL(strMime);
    }

Leave a comment