Open JOSKevinW opened 7 months ago
Hello,
I was not able to test on other platforms than PC. I do not have any devkit.
Sorry.
Btw, the code handling the font in Cog is very small. Imgui is handling 99% of it.
This appears to be addressed by replacing the texture loading code in FCogImguiContext::BuildFont.
It's also notable that the texture format is not PF_R8G8B8A8, it is 4 bytes per pixel, not 8.
`FontAtlasTexture = UTexture2D::CreateTransient(TextureWidth, TextureHeight); FontAtlasTexture->UpdateResource();
auto SrcDataCleanup = [](uint8* Data) { delete[] Data; };
FUpdateTextureRegion2D* TextureRegion = new FUpdateTextureRegion2D(0, 0, 0, 0, TextureWidth, TextureHeight);
auto DataCleanup = [SrcDataCleanup](uint8* Data, const FUpdateTextureRegion2D* UpdateRegion)
{
delete UpdateRegion;
};
FontAtlasTexture->UpdateTextureRegions(0, 1u, TextureRegion, BytesPerPixel * TextureWidth, BytesPerPixel, TextureDataRaw, DataCleanup);`
As a separate issue, Cog rendered on console is very small as opposed to PC. I adapted SCogImguiWidget::OnPaint's calculation of Transform to match what imGui's Unreal integration does. The original code only accounts for transform and not scale.
FSlateRenderTransform displayPosition(DrawData.DisplayPos); const FSlateRenderTransform& WidgetToScreen = AllottedGeometry.GetAccumulatedRenderTransform(); const FSlateRenderTransform Transform = FCogImguiHelper::RoundTranslation(displayPosition.Concatenate(WidgetToScreen));
Thanks a lot for the research! Don't hesitate to make a pull request!
Sorry I didn't reply sooner, was too busy.
We've recently integrated Cog into our Unreal Engine using 5.2.1. We've encountered the font looks corrupted when on the XSX and PS5 platforms; they look correct on Windows. When we increase the DpiScale, it still looks incorrect. Do you expect that this would work on these other platforms too?