How to render raw pixel image in UMG

Hi all,
I’m newbie here. Now what I need is playing live streaming video from a USB camera in UMG. Now I have already read the image from the camera using ffmpeg. The image is just raw image data. How can I render it in UMG?


Basicly, you have to create a texture and copy the pixel data into it.
Then you can use that texture as a brush on an UMG image.

Something like this in C++ :

int32 Width = 1280; //your image size
int32 Height = 720;    

const TArray<uint8>* UncomprBGRA = <YOUR UNCOMPRESSED PIXEL DATA>;
//Create a texture 2d
UTexture2D* tex = UTexture2D::CreateTransient(Width, Height, PF_B8G8R8A8);
    //Lock it
    void* TextureData = tex->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
    //Copy pixel data
    FMemory::Memcpy(TextureData, UncomprBGRA->GetData(), UncomprBGRA->Num());
    //Update texture

Thank you very much, datee, let me try it.