Is it possible to create a texture from an Image ?

Hello :smile:

I am trying to make a texture from a bitmap like this : 
Texture texture = new Texture(image); // image is a bitmap
but I got this error : invalid parameter. I checked if there was a difference in the pixelformat but it was the same. 

Can you help me ? Did I missed a step ?

Thank you in advance,
Alexandre Nicaise


Tagged:

Answers

  • Not a helpful answer, but looks like you are creating a smart component that applies a texture, any chance you made it?  I am trying to create the same thing.  
  • I tried the following code and it worked without exception, where pngPath is the path for a .png figure.

    Bitmap bitmap = new Bitmap(pngPath);
    Texture texture = new Texture(bitmap);
    Material material = new Material(texture);
    graphicComponent.SetMaterial(material, true);