I use SFML to generate a realtime video display which describe the state of a physics simulation. The display consists of lines and dots drawn using OpenGL.
Looking at this old code, I think I can describe the relevant parts as follows:
1) I have a derived class SFML which inherits from sf::RenderWindow. In its constructor, I execute
glEnable(GL_DEPTH_TEST)
2) At he beginning of each frame in the simulation, I execute
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
3) Thereafter, different gl* functions are executed to draw e.g. lines/dots/text etc.
4) Then I execute Display(), which my SFML class has inherited from RenderWindow.
The procedure 2-4 is run for each frame of the simulation. When I hit F1, I get a screenshot PNG file by executing
sf::Image Screen = Capture()
Screen.SaveToFile(s);
inside a keypress event-handler function, where s is the filename string.
I found that I can easily convert my PNGs using ImageMagick, so its no big deal. Something as simple as
convert 1.png -alpha off 2.png
if I remember correctly.