Reputation: 447
function create_geometry_0(scene)
{
var mesh;
var material;
var texture;
var geometry;
geometry = new THREE.BufferGeometry();
geometry.attributes = {
position: {
itemSize: 3,
array: new Float32Array([..my object..])
},
normal: {
itemSize: 3,
array: new Float32Array([..my object..])
}
};
texture = THREE.ImageUtils.loadTexture('ull.jpg');
texture.needsUpdate = true;
material = new THREE.MeshPhongMaterial({
color: 0xFF0000,
...other material stuff
// map: texture
});
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
}
here everything works unless I add the map into my material. But if I add the map everything just stop working. I don't know why. Should i add anything else to my texture!?
Upvotes: 0
Views: 1941
Reputation: 447
it worked finally. i think i had two problems. first my object didn't have any texture coordinate. Second maybe i'd better to use a meshbasicmaterial rather than a meshphongmaterial. and by the way there is no need to that texture.needUpdate command. now my material code is this: material = new THREE.MeshBasicMaterial({ side: THREE.FrontSide, map: THREE.ImageUtils.loadTexture('index_ABASI.jpg') });
Upvotes: 2