Render video transparent background with FBO

#1

Hello!
im trying to render a video with transparent alpha, to incrust in other video, just like this:

its possible using FBO?

im doing something like this:

pseudocode

fbo.begin();
ofClearColor(0,0,0,0);  // ?
shader.begin();
ofSphere();
shader.end();
fbo.end();
#2

Hi,
you need to allocate the FBO so it has an alpha channel.
Use the following for an 8 bit “regular” fbo

fbo.allocate(width, height, GL_RGBA );

Use the following for an 32 bit floating point fbo

fbo.allocate(width, height, GL_RGBA32F_ARB);

Look at examples/gl/fboTrailsExample to see what’s the difference between these.
Hope this helps.
cheers

4 Likes