Capture a Opengl Image from Window

How to use glReadPixels() to read a Opengl window, write the pixel data to a DIB, and submit the DIB for printing?