Forum Migration Notice
Update (2026-01-21): The user forums are now in read-only mode pending the data migration.

Update (2026-01-12): The user forums will be put into read-only mode on the 21st of January, 00:00 CET, to prepare for the data migration.

We're transitioning to a more modern community platform by beginning of next year. Learn about the upcoming changes and what to expect.

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);