Skip to content

Commit

Permalink
DPL GUI: do not use internal methods to retrieve the font texture
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Mar 13, 2023
1 parent a8e04e6 commit 897e168
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions DebugGUI/src/DebugGUIHeadless.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,20 @@ void getFrameRaw(void *data, void **raw_data, int *size, bool includeTextures) {
ImGuiIO &io = ImGui::GetIO();
ImFontAtlas *atlas = io.Fonts;
txtHeader header;
header.width = atlas->TexWidth;
header.height = atlas->TexHeight;
unsigned char *txtPtr = nullptr;
int width = 0;
int height = 0;
int bytesPerPixel = 0;
atlas->GetTexDataAsRGBA32(&txtPtr, &width, &height, &bytesPerPixel);
header.width = width;
header.height = height;
header.format = 0;
header.size = atlas->TexWidth * atlas->TexHeight * 4;
header.size = width * height * bytesPerPixel;

header.id = 0;
memcpy(ptr, &header, sizeof(txtHeader));
ptr += sizeof(txtHeader);
memcpy(ptr, atlas->TexPixelsRGBA32, header.size);
memcpy(ptr, txtPtr, header.size);
ptr += header.size;
}

Expand Down

0 comments on commit 897e168

Please sign in to comment.