[SOLVED] Material.update problem

SOLVED
hope to be helpful to someone else

Code: (without CORS)

        var image = new Image();
        /*image.crossOrigin = "anonymous";*/
        image.onload = function () {
        var texture = new pc.Texture(app.graphicsDevice);
        texture.setSource(image);

        var material = new pc.StandardMaterial();
        material.diffuseMap = texture; 
        material.update();         
        
        pc.app.root.findByName("target_entity").model.meshInstances[0].material=material;
            
        };
        image.src = "external/path/for/example.jpg"; // Remember CORS   
2 Likes