-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translucent shapes appear darker than they should using P2D in setup() after clear() #627
Comments
Created by: PianoMastR64 I'm trying to do tests to figure out the problem, but it just keeps getting more confusing. void setup() {
size(800, 800, P2D);
//noLoop();
clear();
noStroke();
fill(255, 255/2);
rect(0, 0, 195, height); // rect 1
}
void draw() {
switch(frameCount) {
case 1:
rect(200, 0, 195, height); // rect 2
break;
case 2:
rect(400, 0, 195, height); // rect 3
break;
case 3:
rect(600, 0, 195, height); // rect 4
break;
}
} Apparently |
Created by: benfry
This is covered on the reference page: https://processing.org/reference/clear_.html |
Created by: benfry Added a warning for 4.1.2; thought we had one already, but nope. |
Created by: github-actions[bot] This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs. |
Created by: PianoMastR64
If you run this code, you'll see that even though the fill color is the same for both squares, the first one in
setup()
appears darker than it should. The other square indraw()
is drawn correctly. This is only a problem when using theP2D
renderer after callingclear()
, which effectively callsbackground(0, 0)
.If you modify only the renderer to the default
size(800, 800);
, then both squares are drawn correctly. If you modify only theclear()
line intobackground(0)
, then both squares are also drawn correctly.I commented out the stroke lines because they're a bit distracting, but they also convey some interesting information as they're also affected by this bug.
It's also interesting to note that
get()
insetup()
insists that the top left square is (127, 127, 127, 127), but indraw()
it says it's (63, 63, 63, 127) which is what Paint confirms it is in a screenshot (minus the alpha).One more thing is that only translucent shapes are affected, and the lower the alpha, the more dramatic the effect.
The text was updated successfully, but these errors were encountered: