src/OrbitGl/TextRenderer.cpp
ftgl::texture_glyph_t* TextRenderer::MaybeLoadAndGetGlyph(ftgl::texture_font_t* font,
                                                          const char* character) {
  if (!texture_font_find_glyph(font, character)) {
    texture_font_load_glyph(font, character);
    texture_atlas_changed_ = true;
  }

  return texture_font_get_glyph(font, character);
}
// Always use this method when you need to get a glyph, we need to make sure we know when the
// texture atlas has been updated. One way to ensure that is to check if we can find the glyph
// already and, if not, load it explicitly (in which case the texture atlas is updated). Note that
// texture_font_get_glyph internally may load the glyph if it does not find it. We do not want
// that as in that case, we do not know that the atlas has actually changed.
Always use this method when you need to get a glyph, we need to make sure we know when the
texture atlas has been updated. One way to ensure that is to check if we can find the glyph
already and, if not, load it explicitly (in which case the texture atlas is updated). Note that
texture_font_get_glyph internally may load the glyph if it does not find it. We do not want
that as in that case, we do not know that the atlas has actually changed.
Always use this method when you need to get a glyph we need to make sure we know when the texture atlas has been updated . One way to ensure that is to check if we can find the glyph already and if not load it explicitly ( in which case the texture atlas is updated ) . Note that texture_font_get_glyph internally may load the glyph if it does not find it . We do not want that as in that case we do not know that the atlas has actually changed .
ftgl::texture_glyph_t* TextRenderer::MaybeLoadAndGetGlyph(ftgl::texture_font_t* font,
                                                          const char* character) {
  if (!texture_font_find_glyph(font, character)) {
    texture_font_load_glyph(font, character);
    texture_atlas_changed_ = true;
  }
  return texture_font_get_glyph(font, character);
}
ftgl :: texture_glyph_t * TextRenderer :: MaybeLoadAndGetGlyph ( ftgl :: texture_font_t * font , const char * character ) { if ( ! texture_font_find_glyph ( font , character ) ) { texture_font_load_glyph ( font , character ) ; texture_atlas_changed_ = true ; } return texture_font_get_glyph ( font , character ) ; }
Always use this method when you need to get a glyph, we need to make sure we know when the
texture atlas has been updated.
Always use this method when you need to get a glyph we need to make sure we know when the texture atlas has been updated .