Jump to content

texture from dynamically loaded img


Recommended Posts

This used to work for me in an old build of Babylon, but after upgrading to latest I can't get it to work.


Basically I am just creating a texture from an image URL, dynamically. In the newer build, I don't get the texture (I just get a black material). Any ideas? 

var imageSrc = "http://www.someserver.com/someimage.jpg";var img = new Image();img.crossOrigin = 'anonymous';img.onload = function () {                var textureTileImage = new BABYLON.Texture(imageSrc, that._scene);                tile.material.diffuseTexture = textureTileImage;};img.src = imageSrc;



Link to comment
Share on other sites

It turns out this is only happening in IE11 - Firefox and Chrome are displaying the textures just fine!


I will start a separate thread for the issue.


UPDATE: This issue was happening in Safari (iOS8) and IE11. It turns out that it was because I needed to add a call to ComputeNormals in the code I had to create terrain. I am not sure why it wasn't need in Chrome of Firefox, but I seem to be good to go now!

BABYLON.VertexData.ComputeNormals(positions, indices, normals);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...