Hi guys…
I’m working on a screen capture and processing function, where I am doing a screen capture via FScreenshotRequest::RequestScreenshot(true) and doing some simple processing with the attached delegate.
Everything is working hunky dory on a windowed game at say 1920 X 1080, but as soon as I go full screen (my screen is 3440 X 1440), the game crashes with no sensible error detected. I am assuming that my graphics card is running out of memory?
Is there any way to rectify this situation for my users?
Here is my basic function…
void USBGameInstance::TakeScreenShot()
{
if (!UGameViewportClient::OnScreenshotCaptured().IsBound())
{
ocv::delegateHandle = UGameViewportClient::OnScreenshotCaptured().AddStatic(&OnScreenCap);
FScreenshotRequest::RequestScreenshot(true);
}
}
void USBGameInstance::OnScreenCap(int32 Width, int32 Height, const TArray<FColor>& Bitmap)
{
int ulx, uly, lrx, lry;
bool found = false;
for (int i = 0; i < Width; i++) // crashes at some point in these loops.
{
for (int j = 0; j < Height; j++)
{
FColor bmp = Bitmap[i + (j * Width)];
if (bmp.R == 255 && bmp.G == 0 && bmp.B == 255) { // magenta
ulx = i;
uly = j;
found = true;
break;
}
}
if (found) {
break;
}
}
found = false;
}