I can’t get UpdateTextureRegions to work on my ipad air (IOS)
My application terminates right after it is called. However, it works fine for Win64 and Mac platform. The texture uploaded correctly.
Using BulkData.Lock works on IOS but it is too slow since I intend to update texture every frame with device’s camera image stream. Does anyone knows a more suitable method?
Here is a simplified function that crashes after a call on IOS (i made it into an exec function of a playercontroller):
void ASimpleTest_PlayerController::UTT( )
{
static FUpdateTextureRegion2D Region = FUpdateTextureRegion2D(0, 0, 0, 0, 256, 256);
static unsigned char array[256*256*4];
for (int r = 0; r < 256;++r)
for (int c = 0; c < 256;++c)
for (int k = 0; k < 4;++k)
{
array[r*256*4 + c*4 + k] = c+r;
}
CameraImageTexture = UTexture2D::CreateTransient(512, 512);
CameraImageTexture->AddToRoot();
// Allocate the texture HRI
CameraImageTexture->UpdateResource();
UpdateTextureRegions(CameraImageTexture, 0, 1, &Region, 256*4, 4, array, false);
}
Thanks