can you post all of your sketch? how many weeds are you drawing?
this runs smooth on my MacBook Pro at 60fps:
Quote:
import processing.opengl.*;
ArrayList weeds = new ArrayList();
PFont font;
void setup() {
size(1000,200, OPENGL);
frameRate(999);
font = createFont("Courier", 12);
textFont(font);
//strokeJoin(MITER);
for (int i=0; i<250; i++) {
weeds.add(new weed((int)random(width), (int)random(2,20), width, height));
}
smooth();
}
void draw() {
background(0);
for (int i=0; i<weeds.size();i++) {
((weed)weeds.get(i)).update();
}
fill(255);
text("fps: " + frameRate, 10,10);
}
/**
* Seaweed object
*
*/
public class weed{
//vars
float inc = random(5.0);
int x, vUnits;
float angle;
int hSize, vSize;
/**
* CONSTRUCTOR
* Draws at the bottom of the screen,
* iX, horistontal position of the object.
* ivUnits = number of units inside each object, the more units the higher the object.
* ihSize, horisontal size of the drawing screen.
* ivSize, vertical size of the drawing screen.
*/
weed(int iX, int ivUnits, int ihSize, int ivSize){
x = iX;
vUnits = ivUnits;
hSize = ihSize;
vSize = ivSize;
}
/**
* Update/draw method.
*/
void update(){
stroke(0xCC99FF66);
//stroke(10,200,100);
inc += 0.02;
float angle = sin(inc)/10.0 + sin(inc*1.2)/20.0;
pushMatrix();
translate(x, vSize);
for(int i = vUnits; i > 0; i--){
strokeWeight(i/2.5);
line(0, 0, 0, -12);
translate(0, -8);
rotate(angle);
}
popMatrix();
}
}