Hi.
I'm trying to draw a rotating square with shaded colors (red one side with a gradient to yellow on the other side).
There are some artifacts in P2D as you can see in this snippet (I'm using Processing 1.5.1):
void setup() {
size(400,400,P2D);
smooth();
frameRate(30);
}
void draw() {
background(0);
translate(200,200);
rotate(radians(frameCount));
beginShape();
fill(#ff0000, 50);
vertex(-100,-100);
vertex(+100,-100);
fill(#ffff00, 50);
vertex(+100,+100);
vertex(-100,+100);
endShape(CLOSE);
}
Artifacts are visible only when the red side is positioned right/bottom.They disappear when not smoothed.
Any hint to remove them?
Here is an example of what I mean:
There is a number of (mostly) white points where single shaded rectangles are oriented left/north. Artifacts are always on side right/bottom and if the background is pitch dark they are more visible.
I also saw that this shading is not available in JAVA2D (it is rendered as a single color). Is this true or am I missing something?
OPENGL would work (instead of P2D) but here I found another issue I cannot solve.
I create a background OPENGL image (PGraphics) where I draw. This image is far bigger than the screen and I prefere to copy it to the smaller screen only when elaboration is complete.
Doing so I use