Ok, I want to be able to get the raw bits from a texture, and evey tick, change them. So I asume I make an Actor class.
Now here is where I get confused. I have been looking at the code that runs MoviePlayer.h and the various Apple/Microsoft interface and figured out how to access the raw data. The idea is to make an
actor component that outputs a texture (in this case a UTexture2DDynamic) that you can slap onto a mesh. I would use a view-port, but that’s way deeper than I have gotten in the past few days.
This is the pseudo code I have so far.
UTexture2DDynamic* Texture = UTexture2DDynamic::Create(VideoDimensions.X, VideoDimensions.Y, PF_B8G8R8A8); FTexture2DDynamicResource* Res = (FTexture2DDynamicResource*)Texture->CreateResource(); // in tick and after some error checking uint32 Stride; uint8* DestTextureData = (uint8*)RHILockTexture2D(Res->GetTexture2DRHI(), 0, RLM_WriteOnly, Stride, false); FMemory::Memcpy(DestTextureData, TextureData.GetData(), TextureData.Num()); RHIUnlockTexture2D(Res->GetTexture2DRHI(), 0, false);
Before I start heading down this route, is there a better way to do this? How does the rendering engine tell if a texture, dynamic or otherwse, must be updated and is there a way I can flag that?
Eventually I want to make a blueprint compatible component that you can give it input, and just tell it to output a texture.
In a related question, is there a way to use FCanvas against a texture? As the UI interfaces worked like in Doom 3? That’s my real goal at the end of the day.