draw after geomerative
in
Contributed Library Questions
•
1 year ago
I don't see the stuff i draw myself, like i can use background(255, 55, 0) but it doesn't clear etc.
How to avoid this?
import geomerative.*; import processing.opengl.*; // Declare the objects we are going to use, so that they are accesible from setup() and from draw() //RFont f; RShape grp; RPoint[] points; void setup(){ // Initilaize the sketch size(600,400, OPENGL); frameRate(24); // Choice of colors background(255); fill(255,102,0); stroke(0); // VERY IMPORTANT: Allways initialize the library in the setup RG.init(this); // Load the font file we want to use (the file must be in the data folder in the sketch floder), with the size 60 and the alignment CENTER grp = RG.getText("Hello world!", "FreeSans.ttf", 72, LEFT); // Enable smoothing smooth(); // Clean frame background(255); int theX = 0, theY = 0; pushMatrix(); // Set the origin to draw in the middle of the sketch translate(width/7, height/2); // Draw the group of shapes noFill(); stroke(0,0,200,150); RG.setPolygonizer(RG.ADAPTATIVE); grp.draw(); // Get the points on the curve's shape //RG.setPolygonizer(RG.UNIFORMSTEP); //RG.setPolygonizerStep(map(float(mouseY), 0.0, float(height), 0.0, 1.0)); RG.setPolygonizer(RG.UNIFORMLENGTH); RG.setPolygonizerLength(6); points = grp.getPoints(); // If there are any points if(points != null){ noFill(); stroke(0,200,0); beginShape(); for(int i=0; i<points.length; i++){ vertex(points[i].x, points[i].y); } endShape(); fill(0); stroke(0); for(int i=0; i<points.length; i++){ ellipse(points[i].x, points[i].y,5,5); theX = int(modelX(points[i].x, points[i].y, 0)); theY = int(modelY(points[i].x, points[i].y, 0)); } } popMatrix(); fill(255, 0, 0); ellipse(theX, theY, 5, 5); background(255, 55, 0); line(0, 0, width, height); }
1