fbo,vbo,and textures, Oh My!

Hey, gang. I’m currently working on an app that analyzes an input stream of data (from the videoplayer) the creates 3 output streams which each go to a projector of their own. I need to apply some basic operations (blur, composting, etc) according to an alpha channel.

Right now I have everything working with ofTextures, but was wondering if I need to slide them into shaders to do the operations. Also, I was wondering about performance in general. Eventually the output streams will all need to be 720p and there will be some additional openCV analysis going on. In terms of performance, what’s the progression from slower to faster? ofImage<ofTexture<ofFbo<ofShader<openCL/CUDA?

Any advice in general would be appreciated.

NovySan

Ok, I have shaders working.

Still curious whether ofTexture or ofFbo’s, or vbo’s for that matter will be faster. Eventually it’s going to make a difference.

NovySan

it depends on what you want to do:

ofTexture: is memory in the graphics card, you upload an image to it so when you need to draw it is already in the graphics card

ofImage: actually contains an ofTexture + methods to load images from disk, uncompressed the most known formats, resize…

ofFbo: also contains an ofTexture where you can draw things using opengl instead of just uploading pixels

ofVbo: is similar to a texture but for vertexes instead of pixels

ofShader: allows to execute code directly in the graphics card, is good when you need to apply effects that will take too long in the cpu, since the gpu can do lots of operations at the same time

openCL/CUDA: shaders are thought to be used to do graphics processing: vertexes, images… openCL and CUDA allow for more general programming

Thanks for that great answer, it helps clarify immensely.

Right now I have a instance of ofVideoPlayer, I getPixels() from that, and run 3 different operations and loadData() the results into 3 different ofTextures. I’d like to pass the ofTextures to 3 instances of an ofShader, but can’t seem to find the ofTexture equivalent of ofImage’s getTextureReference() method. Right now I’m drawing the ofTextures to the canvas, loading 3 ofImages and masks form disk, sending those ofImages to the shader and then drawing the result ON TOP of the ofTextures with a GLQuad.

I’d like to pass the ofTexture directly into the shader, as it doesn’t exist as an ofImage at all (it’s the result of an image process, not a loadImage()). IS there an equivalent method to getTextureReference() when trying to pass an ofTexture to a shader?

It seems in general it’s a best practice for speed and memory to get away from ofImage as soon as the image is loaded from disk, and use ofTexture and ofShader to stay on the card as long as possible, and draw from the card. Is this generally correct?

Thanks.

NovySan

Ok, got that working too.

Hi, NovySan.

that is great that you got it working.
could you give more details on how did you do that?
i am now learning about just the same thing but got kind of lost, needing some example about it…
thank you !