Another color problem..

edited November 2013 in Questions about Code

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() {
    translate(width/2, height/2);
    vertex(-50, 0);
    vertex(0, 0);
    vertex( 0, 50);
    vertex(-50, 50);
    rect(0, 0, 50, 50);

and the result looks like this even though both objects should be filled with the same color:
Bildschirmfoto vom 2013-11-27 14:41:10

Why are the colors different and what can i do to have both objects in the same color?
Thanks for you help!



  • 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?

  • Answer ✓

    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 :)

Sign In or Register to comment.