I have a 3d Scene which is currently viewed with an ofEasyCam.
I would like to have another camera, or some way to view the scene from another perspective.
I would like this second ‘camera’ to output the pixels to an ofPixels object instead of outputting to screen.
Is this possible? I have explored using an ofFbo slightly but am unsure.
Yes. You can get your scene in an fbo doing something like:
// draw smth here
fbo.readToPixels(pix)); // assuming you have an `ofPixel pix` in your header file.
Thanks for the response, hope you’re having a good Christmas! I’ll try this out thank you.
As a quick note if you feel like helping me more, am I able to manipulate an Fbo like a camera? For example to have the Fbo in another position than the camera in my 3D scene?
the FBO stands for Frame Buffer Object, which is usually understood as an offscreen rendering target. It is super useful in lots of ways, where usually you want to draw something not directly to the screen but somewhere you can either access its pixels, texture or keep it in between frames, without having to render again.
So for the camera you just use an ofEasyCam or ofCamera but to have this rendered into the fbo you need to call it as @edapx explained. Also, keep in mind that
fbo.readToPixels(pix); is an expensive and slow operation, so avoid it as much as you can.