I have a GUI program that uses OpenGL to draw objects. What I’m trying to do is to leverage those drawing routines in order to add the ability to output png images of those objects to another program.
This second program is very basic, and I’m trying to keep it that way. I know how to use OpenGL extensions to create an FBO and RenderBuffer to do offscreen rendering; but I don’t want to add a dependency on GLEW if I don’t have to. Not to mention that there are still a few graphics cards which don’t support FBOs.
So I’m trying to just create a window, keep it hidden, and do my rendering/readback entirely on the back buffer. Except there seem to be two problems with this:
If I don’t show the window, it seems like nothing gets drawn. The glReadPixels() just grabs whatever was in memory there (usually mishmashes of previously displayed images). Why?
In Windows (this needs to be cross-platform so I have two backends for window creation), it appears that the allocated size of the window (which I’m using for my glViewport and glReadPixels calls) is for the entire window, not just the useful area. Title bar and such too. Is there a way around this, preferably that lets me control the usable size directly?