SFML community forums

Help => General => Topic started by: Catch_0x16 on October 27, 2019, 04:50:07 pm

Title: Drawing without SFML window
Post by: Catch_0x16 on October 27, 2019, 04:50:07 pm
Hello,

I'm writing a plugin for a flight simulator, that is written in OpenGL. The simulator creates and manages the OpenGL context/window etc. and all I do is make draw calls (in immediate mode... please don't hate me) as and when it's my plugins turn to draw.

So far, I have been using the sf::Image class to save me from writing my own implementation of loading in .png/.jpeg files etc. Once I've loaded an image, I glGenTextures and glTexImage2D to push to pixel data from the sf::Image class across to my GPU. At this point I pretty much no longer use the sf::Image class at all, and handle drawing by myself.

Now I need to do the same with sf::Text, but can't work out how to get the pixel data. I want to use the SFML classes again, to save me from having to re implement FreeType.

I suppose I have two questions:

Thanks

Catch_0x16
Title: Re: Drawing without SFML window
Post by: G. on October 27, 2019, 10:24:17 pm
You could draw your texts on an sf::RenderTexture, no window needed.
Title: Re: Drawing without SFML window
Post by: Catch_0x16 on October 27, 2019, 11:00:23 pm
Ah! that sounds like a solution, thanks!