I need to convert a .jpg image to a texture at runtime. I currently perform an http request to get the image from a server and store it in a TArray< uint8 >. The problem I run into is that I can’t seem to find a way to convert it into a UTexture2D.
Browsing the answer hub led me to think that this is done using FDDSLoadHelper, but after calling the constructor on my array, IsValid2DTexture() returns false.
Does anyone know the correct way to do this?
Thanks in advance.
P.S. I have verified that the array contains valid jpg data.
Check out the ImageWrapper class - you basically need to load your JPG using that, then you can call getData or whatever and it will give you the uncompressed bitmap data, which you can feed to the DDS or directly into the texture data.
Since I didn’t get an answer for a while, I ended up pre-making the textures and storing them on the server, then getting the textures from the server instead of jpg. At some point (hopefully soon) I will revisit this since I will likely need live tiles. It seems like n00854180t’s answer below may work.