View Full Version : Exporting to a bitmap

07-04-2006, 08:23 AM

I need to render whole scene to a bitmap. How can I do that? Is it even possible?

I am searching for a library that allows me to do it. Something I could set the resulution (DPI) with...

07-04-2006, 10:51 AM
Search and GOOGLE spring to mind or even FAQ's,

this question has been answered many many time are there are hundreds if not thousands of example around

07-05-2006, 02:50 AM
I am sorry, but I am searching. Words "OpenGL" and "export" are very general - google gives wrong results.

Which FAQ? I will do, but please direct me...

07-05-2006, 03:27 AM
You can use glReadPixels (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html) to read the rendered pixels from the framebuffer. All you have to do is write those pixel values to a bitmap file.

07-05-2006, 05:50 AM
Thank you for pointing me at glReadPixels - this seems like a very nice solution. The hard pard is the resolution - I cannot manipulate with the DPI with the glReadPixels.

Is there any other way? I will use this if I wont find anything else.

Thanky you very much for your help.

07-05-2006, 06:23 AM
resolution = nb pixel / realworld size
It only depends on the output size you want.

07-05-2006, 06:23 AM
On searching you could use different key words for searching, like 'capture' , 'framebufer' and 'write' to 'bitmap' 'jpg' 'DPI' etc...

Your DPI is typically fixed to the output device,

So maybe the best you can probably do is to render to the highest resolution you can and then down size that to a higher DPI resolution, obviosuly your image will shrink in physical size

There are high resolution monitors 200/300 and higher DPI rather than standard 72/96 dpi but they are very expensive to say the least, we have some here, so another option is to get a higher resolution DPI device

07-06-2006, 03:58 AM
Look at http://openil.sourceforge.net/

It has some usefull functions for image manipulation

07-06-2006, 09:06 AM
What does DPI have to do with rendering or bitmaps?

You just have to know how big the bitmap should be in pixels. That's the parameters you put into glViewport and glReadPixels.

DPI is only important when displaying or printing something. It's just a number, and has nothing to do with the actual data in the bitmap.

07-07-2006, 02:31 AM
I googled I need to paint in offscreen mode (just to buffer). What do I need set to do this?

Thank you.