We are about to switch to a new forum software. Until then we have removed the registration on this forum.
This is a pretty short question, in the following code line 10 is commented out and nothing is visible. But when it is not commented out we do see a WHITE dot. What is happening? That line doesn't do anything?
void setup() {
size(300,300);
}
void draw() {
background(color(0));
strokeWeight(width/2);
//color c1 = color(255); // works when enabled (but this doesnt do anything?)
colorMode(ADD);
stroke(color(255,0,0,255));
point(width/2,height/2);
colorMode(BLEND);
}
Answers
The problem are in lines 13 and 18 since the constants
ADD
andBLEND
are not valid arguments so their action is unpredictable. If you comment these 2 lines out then line 11 has no effect on the display which is a red circle.Also note that the colorMode is not reset at the start of draw
https://GitHub.com/processing/processing/issues
Are you suggesting it is an issue or the OP should post an issue?
It's not pointing at any particular issue. So it implies the OP should consider posting his own. :\">
@Aedoro --
From the colorMode reference -- https://processing.org/reference/colorMode_.html :
You are using the
mode
keywords fromblendMode()
-- https://processing.org/reference/blendMode_.html :Use the correctly paired command and keywords according to what you are trying to accomplish.
When you ask: "What is happening?" the answer is that these keywords have numerical equivalents -- the value of blendMode keyword "ADD" (2) is the same as the value of the colorMode keyword "ALPHA" (2) and the value of "BLEND" (1) is the same as "RGB" (1).
https://github.com/processing/processing/blob/0abee5af6ad3b11cf2b73bb794b8a97c157c4762/core/src/processing/core/PConstants.java#L227
https://github.com/processing/processing/blob/0abee5af6ad3b11cf2b73bb794b8a97c157c4762/core/src/processing/core/PConstants.java#L258
1 << 0 = binary 01 = 1
1 << 1 = binary 10 = 2
So when you write:
...that doesn't mean anything (the keyword names are invalid), but it gets run as if you had written: