I have a house model in my game, and I have some materials for the house geometry. There is a material for the wall of the house, and I have a texture-map-image to show the bricks.
var mat = new THREE.MeshPhongMaterial( {
ambient: 0x969696,
map: THREE.ImageUtils.loadTexture( 'textures/G/G0.jpg' ),
overdraw: true,combine: THREE.MultiplyOperation
} );
In this way above, the texture map appears like GL_CLAMP
I want it to show like GL_REPEAT
.
What should I do?
If you can not see the images check this.
Image must be 8x8, 16x16, 32x32, 128x128, 256x256, 512x512 etc. And all be working. =)
It's called
THREE.RepeatWrapping
there. TheloadTexture
defaults toTHREE.ClampToEdgeWrapping
(see ctor function from previous link). Don't know if you can use thecallback
(becausethis
in JS is a bit weird (looks like it points to the createdImage
, not the createdTexture
)). Signature:Better you just name the texture locally and set the wrap modes manually:
Looks like you're not going far with threejs without looking at the actual code...
I have posted a full working example at: http://stemkoski.github.com/Three.js/Texture-Repeat.html
The relevant part of the code example is: