Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

SetVertex is memory increasing until crash

$
0
0

This example is increasing the memory until crash, I need to do something more? somebody can help me?

thank you!

  1. PShape s;

  2. void setup() {
  3.   size(100, 100, P2D);
  4.   s = createShape();
  5.   s.beginShape();
  6.   s.vertex(0, 0);
  7.   s.vertex(60, 0);
  8.   s.vertex(60, 60);
  9.   s.vertex(0, 60);
  10.   s.endShape(CLOSE);
  11. }

  12. void draw() {
  13.   translate(20, 20);
  14.   for (int i = 0; i < s.getVertexCount(); i++) {
  15.     PVector v = s.getVertex(i);
  16.     v.x += random(-1, 1);
  17.     v.y += random(-1, 1);
  18.     s.setVertex(i, v);
  19.   }
  20.   shape(s);
  21. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles