Hi there,
I’ve got a simple question and I hope there is a simple answer^^
How I can render 2 Scenes in 2 FBOs separately?
Is this possible?
Greets
Hi there,
I’ve got a simple question and I hope there is a simple answer^^
How I can render 2 Scenes in 2 FBOs separately?
Is this possible?
Greets
Hi Jose Man,
This is absolutely possible and fair simple.
you want to have two ofFbo objects which you’ve allocated and then simply within draw you can write:
fboA.begin();
// Render Scene 1
fboA.end();
fboB.begin();
// Render Scene 2
fboB.end();
Then to view them just draw the directly to the screen:
fboA.draw(0, 0);
fboB.draw(fboA.getWidth(), 0);
Okay, thank you. But work this also:
fboA.begin()
sceneA.draw(0,0,0);
fboA.end();
fboB.begin()
sceneB.draw(0,0,0);
fboB.end();
I mean, SceneA has completely different Lightning and shading for example than SceneB.
You know what I mean?
Is this possible?
Hey Jose,
I don’t know what kind of object your scene object is, but in general this should work.
What object is your sceneA?
JB
Hi Bentley,
Let me explain it as an example:
The first scene is a 2D-Game for example. No Light, no shading. Just simple 2d-graphics.
The 2nd scene is complex 3D-Scene with Lights and Camera movement and shading and so on.
I want to use the FBOs from both scenes to render them on a Cube-Surface, for example.
1 Scene on on the one surface and the other Scene on the other surface…
I know… it sounds strange but something like that I want to do…
I think its a not very simple.
Because there must be a separate render context for each scene…
Maybe I have to reset and set all the scene-settings for each scene everytime I want to render the scenes…
Is there a simple and fast way to set all the OpenGL and render settings to default?
Hi Jose,
I’m not sure of there’s a way to set all openGL settings to default but you can use
ofPushMatrix();
ofPushStyle();
// Render
ofPopStyle();
ofPopMatrix();
to push and pop many openframeworks settings.
JB
Hi Bentley,
ah, okay. Cool. I’ll take a look