Opengl save image


How can i save the drawings on a GLCanvas as a image file.

Hi !

You can’t with OpenGL.

You can get image with glReadPixels into a buffer, then you will need to use other code or an existing library to save the code in some format.

There are lots of libraries available for reading/writing images, have a look at and

If you want to do it yourself, most image file formats can be found at