Image texture in a cube
See original GitHub issueI 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?
Issue Analytics
- State:
- Created 12 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to Texture a Cube in Blender : 4 Steps - Instructables
Now click on the little button that has the dot in the middle of it towards the right of the Color line in...
Read more >Tutorial 5 : A Textured Cube
When texturing a mesh, you need a way to tell to OpenGL which part of the image has to be used for each...
Read more >CubeTexture – three.js docs
CubeTexture. Creates a cube texture made up of six images. ... CubeTexture is almost equivalent in functionality and usage to Texture.
Read more >100+ Free Texture Cube & Texture Images - Pixabay
Find images of Texture Cube. ✓ Free for commercial use ✓ No attribution required ✓ High quality images.
Read more >Texturing a cube with different images using OpenGL
so you simply add the x,y to your texture coordinate for each vertex of each face where i is the selected texture and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ok, I have looked and change my source code to:
But everything is strange here. It is not repeating the image along the face. I want to know what’s the meaning of these numbers… I saw in the three.js source code that is a Vector2, but I don’t know what they really do.
Another question is about the image size. Does it matter?
Try this project . Full code available below. https://github.com/karmakumar/threejs_create_plane/tree/dev/three