I am writing a program where I need to save a opengl scene as a image. The writing code is already working except one thing: The application is resizable and therefor the screenshot also is variable in size. Therefor I tried the gluscaleimage() that worked but as it seem to create horrible results if the window is very small I cant really use it.
Instead my idea is to adjust the viewport to whatever resolution I want the image in, render the scene to a buffer instead of screen (that is; a buffer that is not the framebuffer), and writing the buffer to file. However I do not know how to render to a buffer (if its even possible). I tried doing it with the framebuffer (adjusting the viewport) but the part of the scene that was outside the edges of the window was cut away. Other than that it worked as wanted. Any ideas on how to fix this problem?