How to save drawings in 'jpg' format using opengl on linux?

I want to create pic using opengl on linux, but I prefer save jpg pictures directly instead of snapshooting from the screen.

Can anyone provide me some useful class library?

Try DevIL

i personally use SDL library so i use the add-on SDL_image ( for all my image needs

But maybe I emphasize the wrong thing :slight_smile:
My problem is the direct picture creating(no screen, window, I don’t want to display!).

For example, I read data from the file, imagine that according to the data I render 3d staffs on computer memory instead of the screen, then I save this picture.
That is what I want to do.

Helps are expected!

Then I’m not sure OpenGL can be of help for your requirements. I personally don’t know any opengl libraries that can draw without using any window and context. You can at least do off-screen rendering, but you’ll need a window. Anyway this will be rendered in a buffer, so drawed somewhere even if it’s not shown.

Hope this helps.

if you just don’t want to see the rendering in a window, leave out the XMapWindow function call (assuming that you are using Xlib).

off-screen mesa

Mesa has special functions that can be called to
create a rendering context that does not require X.

off-course everything is software rendered.

This is the first time I’ve read these forums, and
already I’ve posted twice about mesa.

But seriously, OSMesa is very useful. I’m just surprised that people have aren’t aware of it.
The “OS” part of it, I’m sure they’ve heard of Mesa.


slightly off-topic – can glX not create a pbuffer without having a window somewhere?


I have tried osmesa, it’s very useful and satisfies the requirements.

People here are very helpful. Thanks again!

Originally posted by OneSadCookie:
slightly off-topic – can glX not create a pbuffer without having a window somewhere?
I haven’t used pbuffers before, but I don’t
believe a window is necessary. A connection to
the X server is required.

Basically, if you want the card to do any work
you must be connected to the X server.


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.