Hi! My goal is to save each frame as an image with floating point precision per channel.
I set up my app to have a 256 x 256 window
in the header:
ofFbo fbo; ofFloatPixels pix; ofFloatImage img;
then in setup
int w = screenWidth; int h = screenHeight; fbo.allocate(w, h, GL_RGB32F); pix.allocate(w, h, GL_RGB32F); img.allocate(w,h, OF_IMAGE_COLOR);
then in draw
fbo.begin(); ofClear(0,0,0, 255); shader.begin(); meshes[ix].drawVertices(); // draw once for FBO shader.end(); fbo.end(); fbo.readToPixels(pix); camera.begin(); shader.begin(); meshes[ix].drawVertices(); // draw again for screen img.grabScreen(0, 0, 256, 256); shader.end(); camera.end(); string num = (ofToString(ix + 3250, 8, '0')); img.save("screengrab" + num + ".png", OF_IMAGE_QUALITY_BEST); ofSaveImage(pix,"fbo" + num + ".png");
Hypothetically the image saved from the FBO should be the same as the image grabed from the screen?
BUT this is what the FBO image looks like:
and this is from img.grabScreen:
and this is what its supposed to look like (taken with a simple call to ofSaveScreen ):
I have tried allocating with different gl pixel types. My problem would also be solved if ofSaveScreen could make an image thats 32 bits per channel.
Thank you for taking the time to read this!! Please let me know your intuitions, or if I am misunderstanding some concepts & let me know any suggestions!
update - fbo output as jpg is correct looking but only 8 bits per channel! So close !!