Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Saving FBO/grabScreen to ofFloatImage results in unexpected output

$
0
0

@char wrote:

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:
ptCloud_encoded00003250
and this is from img.grabScreen:
ptCloud_encoded00003250
and this is what its supposed to look like (taken with a simple call to ofSaveScreen ):
ptCloud_encoded00003250

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!

Thank you

Char


update - fbo output as jpg is correct looking but only 8 bits per channel! So close !!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles