I\'m rendering into an OpenGL offscreen framebuffer object and like to save it as an image. Note that the FBO is larger than the display size. I can render into
Two questions to start: How are you creating imageSaver and are you sure your width and height are correct (e.g. are you trying to save a 1024 x 1024 image? What size are you getting)?
This sounds like you have the wrong viewport size or something similar.
Finally I solved the issue.
I have to activate the fbo for saving its contents:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
// save code
...
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
while only selecting the fbo for glReadPixels
via
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
doesn't suffice.
(All other things where correct and tested, eg. viewport sizes, width and height of buffer, image texture etc.)
You're not doing anything wrong, this has been quite common behaviour with OpenGL graphics drivers for a long time - I recall running up against exactly the same issue on nVidia Geforce 3 cards at least a decade ago, and I adopted a similar solution - rendering to an offscreen texture.