Rendering in batch mode only to save into a file

I am using OpenGL to render a 3D image (on UNIX or MacOS). I know how to render and save data into a file. However, I would like to be able to render an image in a “batch” mode, without popping up a window with the image. Sort of calling it like

>myprog input output.png

and get the image. Similar to how I use ImageMagick. Do you know any resources or doc to read. Maybe a recipe? Please, help!

PS. I am pretty sure there were a topic like this. However, I could not find it. Please, give me a link, if you know!

PSS. Although I am an experienced programmer, I am a total beginner in OpenGL. Please, do not judge too strict :slight_smile:

You’re going to have to create a window one way or another. You can choose not to display the window, and then render to an FBO which you then read from and write to a file.

Could you please explain more. Should I use a window manager (like glut) or I can just virtually to set up the area where to plot, plot to the memory and get all pixels? How not to start a window on glut or I should use other library, maybe or something else. Thank you.