Draw multiple ofPixels using Fbo

Hi, I would like to draw multiple ofPixels on Fbo at given positions. ofPixels are used to get pixels from 2 cameras.
I also have another question. Does it be more effective if I use ofTexture or ofImage ?
Thank in advance .^ ^.

Hi @PhuDoTuong,

As far as I understand it, an ofPixels is a cpu representation of an image, and an ofTexture is a representation for the gpu. An ofImage has both components; there is an ofPixels and an ofTexture inside of an ofImage. There is a nice ofBook chapter on this topic here: ofBook - Image Processing and Computer Vision. And there are example projects that use these classes, like /examples/shader/06_multiTexture.

You can get ofPixels from an ofVideoGrabber (webcam) if you want to do something to them, or you can just call .draw() on the ofVideoGrabber. In the .draw() call you can specify where to draw it on the screen along with the width and height if you like. You can do this in ofApp::draw(), or in an ofFbo in ofApp::update(). If you don’t want the ofFbo to be cleared between draws, make sure to call ofSetBackgroundAuto(false) in ofApp::setup(). You can also use multiple ofFbo if you need to.

So, there are lots of options and hope this helps. Have fun!

1 Like