SFML community forums
Help => Graphics => Topic started by: nagimar on May 12, 2025, 10:37:37 am
-
Hi!
In the class sf::Font, call the update function here :
page.texture.update(&m_pixelBuffer[0], w, h, x, y);
But I don't find where you call glGenTexture, the update function from the texture class doesn't call glGenTexture.
Is this normal ?
This is the code of the SFML 2.5.1.
-
glGenTexture is called from within the sf::Texture implementation, see here: https://github.com/SFML/SFML/blob/2.6.2/src/SFML/Graphics/Texture.cpp#L167
When a new page is inserted into the sf::Font, then a new texture is created and glGenTexture is called.
PS: I've edited your title, since "I have a question" is quite a bad subject title, see also: https://en.sfml-dev.org/forums/index.php?topic=5559.0
-
Ok but where do you call create on the texture font page ?
I only see the call of update, but not the call of create.
-
loadPage creates an instance of the Page struct which default initializes the texture: https://github.com/SFML/SFML/blob/2.6.2/src/SFML/Graphics/Font.cpp#L571
A constructor doesn't always need to be explicitly called.
-
Ah ok it's in loadPage. Thanks.