Loading...
Logo
Processing Forum
Hi there,

I have a code snippet for a Doom Viewer written fo an Alpha version of Processing. I have been trying to update it so that it works today but am stuck. At the moment, this code does not seem to like g, or modelview. I don't really understand how this works, but if anybody has experience trying to write a similar bit of code that works on today's processing, I would be much obliged for some help.

The code I have is below:

Copy code
  1. final int BOXSIZE = 30;
    PMatrix3D matrix = new PMatrix3D();

    void setup(){

      size(200,200,P3D);
      matrix.reset();
     
    }

    void draw(){

      background(100);
      translate(width/2,height/2);
      int oldmouseY = mouseY;
      PMatrix3D mat = new PMatrix3D();
      mat.reset();
      mat.rotateY(0.0001 * (mouseX-(width/2)));
      mat.translate(0,0,0.2);
     
      matrix.preApply(mat);
      oldmouseY=mouseY;
      g.modelview.preApply(matrix);
     
      for (int i = 0; i < 10; i++){
         for (int j = 0; j < 10; j++){
           pushMatrix();
           translate(40*(i-5),0,-40*j);
           box(BOXSIZE,BOXSIZE,BOXSIZE);
           popMatrix();
         }
      }
     
    }
Thanks,

Erica.