Skip to content

Cross-domain image for texture #7

@chimanaco

Description

@chimanaco

Hi, first of all thank you so much for creating _three.js playGnd.
I definitely started to play with three.js thanks to this.

Let me ask you about texture with a cross-domain image.
I want to load images from Instagram and use it for textures for geometries.
However, I haven't done yet.

On _three.js playGnd, I can see a texture by the following code.

map = THREE.ImageUtils.loadTexture('../texturez/proxy.php?url=http://distilleryimage6.ak.instagram.com/77a4df402ebf11e38c1322000a1fb036_7.jpg');
geometry = new THREE.CubeGeometry(200, 200, 200);
material = new THREE.MeshLambertMaterial({shading: THREE.FlatShading, color: 0xdcdcdc, map: map});
mesh = new THREE.Mesh(geometry, material);
map.wrapS = map.wrapT = THREE.RepeatWrapping;
map.repeat.set( 1, 1 );
scene.add(mesh);

I use proxy.php you mentioned in Stack Overflow.

cross-domain image for three.js (canvas/webGL), proxy? - Stack Overflow
http://stackoverflow.com/questions/17710414/cross-domain-image-for-three-js-canvas-webgl-proxy

In addition, I also set access control using express.js.

app.all("/", function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST");
return next();
});

I downloaded _three.js playGnd code from Github and had a look at, but I haven't found a solution. Did you do anything else on _three.js playGnd but use proxy.php?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions