Hi,
I’m pretty new with OF and i’ve been trying to port this simple code from Processing but i can’t seem to find the equivalent of g.get(int,int,int,int)
Any help/suggestion will be greatly appreciated.
This is the Processing code:
PImage trail;
void setup() {
size(640,480,P3D);
trail = new PImage(width,height);
background(0);
noStroke();
}
void draw() {
image(trail,0,0,width,height);
fill(255,0,0,32);
rect(mouseX,mouseY,20,20);
trail = g.get(10,10,width-20,height-20);
}
This is the OF code:
#include "testApp.h" // contains ofImage trail;
void setup() {
ofBackground(0, 0, 0);
ofEnableAlphaBlending();
trail.allocate(640,480,GL_RGB); // Is it the correct equivalent
// of 'trail = new PImage(width,height);' ?
}
void draw() {
trail.draw(0,0,width,height);
ofSetColor(255, 0, 0, 32);
ofRect(mouseX,mouseY,20,20);
// should the equivalent of
// 'trail = g.get(10,10,width-20,height-20);' be here?
}