javascript - Three.js create texture from image file -


I have a problem, in which three from the image file I have a function to make mesh that looks like this:

  var image = document.createElement ('img'); Image.src = imageFile; Var Textures = New Three Mix (image); Var mat = new three. Mashfong content (); Mat.map = Texture; Var Aries = New Three. Aries (new three. Plain gemetry (20, 20), mat); Var plane = trap; Plane.position.x = 0; Scene.add (aircraft);  

However, my texture provides black color and the image does not appear to render properly.

The easiest way to use the image in the form of texture is to call it three. IJU Utill. Loads using loads (URL, mapping, onload, on error) , here is an example:

  var mesh = new three. Aries (New three.PlanGometry (1, 1, 1, 1), new three.Messbaceic content ({map: three image imit.load texture ('/ my-image .jpg')}));  Three. Constructor accepts an image as its first parameter, I think the problem you are experiencing is because you are not waiting for the image to complete the load By using  ImageUtils  you can avoid tackling callbacks. 


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -