Loading...
Logo
Processing Forum
Hi!

When rendering this variation of the rgbcube example, using strokes in place of fills, I get what I want in java mode but the colors get changed in javascript mode. Apparently, colors are handled differently in stroke and fill methods, and it looks like a little bug is hiding there...
Copy code
  1. float xmag, ymag = 0;
    float newXmag, newYmag = 0;

    void setup()  {
      size(640, 360, P3D);
      colorMode(RGB, 1,1,1,1);
    }
     
    void draw()  {
      background(0.6);
      pushMatrix();
      translate(width/2, height/2, -30);
      newXmag = mouseX/float(width) * TWO_PI;
      newYmag = mouseY/float(height) * TWO_PI;
      float diff = xmag-newXmag;
      if (abs(diff) >  0.01) {xmag -= diff/4.0; }
      diff = ymag-newYmag;
      if (abs(diff) >  0.01) {ymag -= diff/4.0; }
     
      rotateX(-ymag);
      rotateY(-xmag);
      strokeWeight(5);                  
      noFill();
      scale(100);
     
      beginShape(QUADS);

        stroke(0,1,1,1);    vertex(-1,1,1);
        stroke(1,1,1,1);    vertex(1,1,1);
        stroke(1,0,1,1);    vertex(1,-1,1);
        stroke(0,0,1,1);    vertex(-1,-1,1);
           
        stroke(1,1,1,1);    vertex(1,1,1);
        stroke(1,1,0,1);    vertex(1,1,-1);
        stroke(1,0,0,1);    vertex(1,-1,-1);
        stroke(1,0,1,1);    vertex(1,-1,1);
           
        stroke(1,1,0,1);    vertex(1,1,-1);
        stroke(0,1,0,1);    vertex(-1,1,-1);
        stroke(0,0,0,1);    vertex(-1,-1,-1);
        stroke(1,0,0,1);    vertex(1,-1,-1);
           
        stroke(0,1,0,1);    vertex(-1,1,-1);
        stroke(0,1,1,1);    vertex(-1,1,1);
        stroke(0,0,1,1);    vertex(-1,-1,1);
        stroke(0,0,0,1);    vertex(-1,-1,-1);
           
        stroke(0,1,0,1);    vertex(-1,1,-1);
        stroke(1,1,0,1);    vertex(1,1,-1);
        stroke(1,1,1,1);    vertex(1,1,1);
        stroke(0,1,1,1);    vertex(-1,1,1);
           
        stroke(0,0,0,1);    vertex(-1,-1,-1);
        stroke(1,0,0,1);    vertex(1,-1,-1);
        stroke(1,0,1,1);    vertex(1,-1,1);
        stroke(0,0,1,1);    vertex(-1,-1,1);
      endShape();
     
      popMatrix();
    }
What could I do to have coherent results on both modes ? Thank you !

Replies(1)

i get the same results with your code, and also when trying:

size(640, 360, OPENGL); 

i would post to the googlegroup where a lot of the people who actually maintain the source hang out.


if no one can suggest a fix that is a problem with your code then post to the bug tracker: