We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
i got another color problem. When drawing a rect and any shape with beginShape/endShape in P3D colors are displayed differently for the rect and the shape object. My example code is the following:
public void setup() {
size(800, 600, P3D);
colorMode(HSB, 360,100,100);
}
public void draw() {
background(330);
lights();
translate(width/2, height/2);
noStroke();
fill(color(0,0,80));
//rect1
beginShape();
vertex(-50, 0);
vertex(0, 0);
vertex( 0, 50);
vertex(-50, 50);
endShape();
//rect2
rect(0, 0, 50, 50);
}
and the result looks like this even though both objects should be filled with the same color:
Why are the colors different and what can i do to have both objects in the same color?
Thanks for you help!
Answers
i'm guessing the lights() is the problem, that one of the rectangles is effected by lights and the other isn't.
Probably light is the reason for it, but is it supposed to be like that, am i doing something wrong or is it a bug?
That's how it's supposed to be. There's no bug here. The calls to vertex() are drawing a 3D shape that takes the lights() into account. The call to rect() is drawing a 2D shape directly on the canvas, ignoring the lights().
Ok thanks a lot, then i will just draw my own rect as a vertex-shape :)