Skip to content

Image texture in a cube #1467

@nathaliaspatricio

Description

@nathaliaspatricio

I create a cube and I'm trying to apply some texture on it using this code:

function createCube(sx, sy, sz, p, ry, image){

    var texture = THREE.ImageUtils.loadTexture(image);

    var material = new THREE.MeshLambertMaterial( { map: texture } );
    var cube = new THREE.Mesh( new THREE.CubeGeometry( sx, sy, sz ), material );
    cube.position = p;
    cube.rotation.y = ry;
    scene.add(cube);

}

I need to repeat the image only in one cube face like a wallpaper. I have tried to use RepeatWrapping, but it didn't work and I'm not finding this object in the three.js source code to understand how it works.

Any help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions