topical media & game development

talk show tell print

graphic-processing-algorithm-Ch02-p52-p52.pde / pde



  int n = 4;
  int[] xArray = new int[n]; //allocate memory
  int[] yArray = new int[n];
  xArray[0] = 20; //first point
  yArray[0] = 20;
  xArray[1] = 20; //second point
  yArray[1] = 80;
  xArray[2] = 80; //third point
  yArray[2] = 80;
  xArray[3] = 80; //fourth point
  yArray[3] = 20;
  beginShape(POLYGON);
  for(int i = 0; i < n; i++)
    vertex(xArray[i],yArray[i]); //retrieve in an ordered fashion
  endShape(CLOSE);
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.