4
\$\begingroup\$

Since ImGui builds on top of stb_truetype for its font rendering, I thought it could be nicer to use its already built font-processing capabilities (ImGui::GetIO().Fonts), and render with those, instead of using stb_truetype directly.

However, I've been having trouble figuring out how to do this, specifically how to get quad position/texture coordinates for a given string to use with the preloaded texture at ImGui::GetIO().Fonts->TexID.

I'm not looking to draw buttons/text inside ImGui windows, all I want to do is to use ImGui to build vertex data for a given string so that I can render it anywhere.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

From the GitHub issue you opened and the ImgUi FAQ:

Create a dummy window with NoTitleBar|NoResize|NoMove|NoScrollbar|NoSavedSettings|NoInputs, then you can retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like.

\$\endgroup\$
2
  • \$\begingroup\$ the "Imgui FAQ" link is broken \$\endgroup\$
    – Anentropic
    Commented Apr 2, 2021 at 9:58
  • \$\begingroup\$ @Anentropic fixed. thanks! \$\endgroup\$ Commented Oct 19, 2021 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .