1

I'm using r71 of three.js and canvg library. I'm using canvg to display the SVG but it comes up with the following error.

Failed to load resource: the server responded with a status of 404 (Not Found)

Here is the following code in question:

    var imageCanvas2 = document.createElement("canvas");
    canvg(imageCanvas2, 'https://upload.wikimedia.org/wikipedia/commons/a/a3/WikiProject_Zoo_Logo.svg');

        var texture1 = new THREE.Texture(imageCanvas2);


        //FOUR - TETRAHEDRON
        var loaderFour = new THREE.JSONLoader( true );
        var materialsArray = [];
        materialsArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture(texture1)}));
        texture1.needsUpdate = true;
        materialsArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture("./resources/images/Alerts.png")}));
        materialsArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture("./resources/images/IPT.PNG")}));
        materialsArray.push(new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture("./resources/images/action-item-tracking.png")}));

        for(var i = 0; i <= 3; i++) {
            materialsArray[i].map.minFilter = THREE.LinearFilter;
        }

        loaderFour.load("./resources/json/tetra.json", function (model) {
                var materialFour = new THREE.MeshFaceMaterial(materialsArray);
                four = new THREE.Mesh(model, materialFour);//issue according to three.js
                four.translateY(1);
                four.scale.set(3, 3, 3);
                meshFour = THREE.SceneUtils.createMultiMaterialObject(four, materialFour);
                for( var i = 0; i < model.faces.length; i++ )
                { model.faces[i].materialIndex = i; }
                scene.add(four);
            });
ACoder
  • 107
  • 1
  • 11
  • 1
    this is discussed here: https://github.com/mrdoob/three.js/issues/1317 – gaitat Aug 05 '15 at 19:07
  • The material color does not show through the texture -- it tints the texture. See http://stackoverflow.com/questions/31738809/three-js-meshbasicmaterial-doesnt-work-as-aspected – WestLangley Aug 05 '15 at 19:18
  • @WestLangley Are you telling me to use ShaderMaterial? I'm wondering because I'm using a json file to generate the polyhedron. – ACoder Aug 07 '15 at 19:15
  • If it is a decal-effect that you want, then yes. – WestLangley Aug 07 '15 at 19:25

0 Answers0