Andor Salga

Test for rect() 3D in Pjs

// Test by Andor Salga
import processing.opengl.*;

int START_X = 10;

int counter = 0;
int currX = START_X;
int currY = 10;

int RECTS_PER_ROW = 10;
int RECT_SIZE = 30;

int Y_OFFSET = 50;
int X_OFFSET = 50;

void setup()
{
  size(500,500, OPENGL);
  strokeWeight(6);

  // default
  drawRect();
  
  fill(0);
  drawRect();
  
  fill(0);
  drawRect();
  
  fill(0);
  drawRect();
  
  fill(0);
  drawRect();

  fill(0);  
  drawRect();

  fill(128,0,0);  
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();
  
  fill(128,128,0);
  drawRect();

  noStroke();
  fill(0,128,0);
  drawRect();  

  stroke(0);
  fill(0,128,0);
  drawRect();    

  stroke(255,0,0);
  fill(0,128,0);
  drawRect();    

  stroke(255,0,0);
  fill(0,128,0);
  drawRect();

  stroke(255,128,0);
  fill(128,128,128);
  drawRect(); 
 
  stroke(255,0,0);
  fill(128,128,128);
  drawRect();
  
  stroke(255,0,0);
  fill(128,128,198);
  drawRect();
  
  stroke(255,0,0);
  fill(128,128,128);
  drawRect();
  
  
  ///////////////
  
  fill(255);
  drawRect();

  fill(0);
  drawRect();
  
  fill(0);
  drawRect();
  
  fill(0);
  drawRect();
  
  fill(0);
  drawRect();

  fill(0);  
  drawRect();

  fill(128,0,0);  
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();

  fill(128,0,0);
  drawRect();
  
  fill(128);
  drawRect();

  noStroke();
  fill(0,128,0);
  drawRect();  

  stroke(0);
  fill(0,128,0);
  drawRect();    

  stroke(255,0,0);
  fill(0,128,0);
  drawRect();    

  stroke(255,0,0);
  fill(0,128,0);
  drawRect();

  stroke(255,128,0);
  fill(128,128,128);
  drawRect(); 
 
  stroke(255,0,0);
  fill(128,128,128);
  drawRect();
  
  stroke(255,0,0);
  fill(128,128,128);
  drawRect();
  
  stroke(255,0,0);
  fill(0,32,128);
  drawRect();
}

void drawRect(){
  
  rect(currX, currY, RECT_SIZE, RECT_SIZE);

  if(counter % RECTS_PER_ROW == 0 && counter > 0){
    currX = START_X;
    currY += Y_OFFSET;
  }else{
    currX += X_OFFSET;
  }

  counter++;
}