SFML community forums

Help => Graphics => Topic started by: nagimar on May 12, 2025, 10:37:37 am

Title: Where is glGenTexture called?
Post by: nagimar on May 12, 2025, 10:37:37 am
Hi!
In the class sf::Font, call the update function here :

Code: [Select]
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.
Title: Re: Where is glGenTexture called?
Post by: eXpl0it3r on May 12, 2025, 10:48:31 am
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
Title: Re: Where is glGenTexture called?
Post by: nagimar on May 12, 2025, 12:44:53 pm
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.

Title: Re: Where is glGenTexture called?
Post by: eXpl0it3r on May 12, 2025, 01:11:40 pm
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.
Title: Re: Where is glGenTexture called?
Post by: nagimar on May 12, 2025, 01:26:33 pm
Ah ok it's in loadPage. Thanks.