I am writing some code that is built on top of OpenGL to do rendering. I would like to write some unit tests (using google test preferably) to exercise and verify that code. As such, it does not require a UI. It will merely render some images, read them back, and check them for correctness, e.g. by comparing with golden images. Perhaps the PBuffers or Frame Buffer Objects are better than opening a window, but it doesn’t really matter to me as long as I can determine when rendering is done and get the pixels. I also want to do timing measurements.
Can someone provide me with some code that can initialize GL for rendering offscreen? Am I correct to assume that rendering to an offscreen buffer takes the same amount of time as rendering to a window?
TestState *st =InitGLForMe(width, height, pixelFormat, pixelType);
Initially, I am developing this for the Macintosh with OpenGL 1 or 2, but would also like to run on other platforms, such as Android with OpenGL ES.
Can you provide me with these functions (in green above)? Or possible refer me?