using a texture mesh and wireframe mesh in threejs

Posted by Andy Poes on Stack Overflow See other posts from Stack Overflow or by Andy Poes
Published on 2012-09-11T21:33:18Z Indexed on 2012/09/11 21:38 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

I'm trying to draw a wireframe mesh and a textured mesh in threeJS but when I have both added to my scene the textured mesh doesn't display. Code below:

I'm having trouble creating two meshes that share the same geometry where one of the materials is wireframe and the other is a texture. If one of the materials is wireframe and the other is just a color fill it works fine- but as soon as I make the second material a texture it stops working.

If I comment out scene.add( wireMesh ); then the textured mesh shows up.

var wireMat =  new THREE.MeshBasicMaterial( { color:0x00FFFF, wireframe: true,                 transparent: true, overdraw:true } );
var wireMesh = new THREE.Mesh(geometry, wireMat);
scene.add( wireMesh );

var texture = texture = THREE.ImageUtils.loadTexture( 'textures/world.jpg' );

var imageMat = new THREE.MeshBasicMaterial( {color:0xffffff, map: texture } );

var fillMesh = new THREE.Mesh(geometry, imageMat);
scene.add( fillMesh );

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about opengl-es