FIX: init_font crash

Change-Id: I2d2fd9f297e2980e789b124d3e026d0db1fa1602
This commit is contained in:
liz.li 2022-11-29 22:41:33 +08:00 committed by Lane.Wei
parent dfde6e518f
commit 1f0ce4ac47
5 changed files with 36 additions and 10 deletions

View file

@ -1979,6 +1979,7 @@ void ImGuiWrapper::init_font(bool compress)
unsigned char* pixels;
int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
BOOST_LOG_TRIVIAL(trace) << "Build texture done. width: " << width << ", height: " << height;
// Fill rectangles from the SVG-icons
for (auto icon : font_icons) {