Frame Buffer Objects FBOs in processing
in
Programming Questions
•
3 years ago
Hi!
I need to have several OPENGL scketches running in the same processing program, each with a different animation.
In Openframeworks this is called FBO's Frame Buffer Objects, and in processing this function is made by PImage or PGraphics objects. But when i try to use two PGraphicsOpenGL objects in teh same PApllet.PGraphic object yhis doesn't run.
An example:
import processing.opengl.*;
PGraphics g1, g2;
void setup() {
size(600,300,OPENGL);
g1 = createGraphics(width/2, height, OPENGL);
g2 = createGraphics(width/2, height, OPENGL);
}
void draw() {
background(0);
g1.beginDraw();
g1.background(0);
g1.endDraw();
g2.beginDraw();
g2.background(255,0,0);
g2.endDraw();
println("g1: " + g1.width +" "+ g1.height);
image(g1,0,0, g1.width, g1.height);
image(g2,width/2,0, g2.width, g2.height);
}
Thanks!
1