@Ziga_Jaglicic wrote:
Hello!
Im trying to create a 50x50 grid of quads and animate them with ofNoise().
http://postimg.org/image/4n76qmclf/ <-- this is a picture of what i'm doingAnd this is my code: here i setup a grid
for (int y=0; y<50; y++) {
for (int x=0; x<50; x++) {
w[x+y*50] = x*size+ofNoise(x*0.1, y*0.1, ofGetFrameNum() / 3.0)*30;
h[x+y*50] = y*size+ofNoise(x*0.1, y*0.1, ofGetFrameNum() / 3.0)*30;
d[x+y*50] = 0;
}
}and here i draw the rectangles:
for (int y=0; y<49; y++) {
for (int x=0; x<49; x++) {
ofSetColor(120, ofRandom(160), 130);
ofBeginShape();
ofVertex(w[x+y*50], h[x+y*50], d[x+y*50]);
ofVertex(w[x+1+y*50], h[x+1+y*50], d[x+1+y*50]);
ofVertex(w[x+1+(y+1)50], h[x+1+(y+1)50], d[x+1+(y+1)*50]);
ofVertex(w[x+(y+1)50], h[x+(y+1)50], d[x+(y+1)*50]);
ofEndShape();
}
}I'm trying to animate ofNoise() but curently it takes aprox. 0.5seconds to render each frame. I tried to get the same effect with ofMesh() but I didn't know how to draw rectangles, there were gradients instead of full color and I'm not eve sure if its faster.
So, is what is the best way to aproach this problem.
Thanks in advance,
Ziga
Posts: 3
Participants: 3