Hi Calsign, thanks for responding and testing the code. However, I already played around with smoothing, and tried different theta incrementation values... I get the same errors even (albeit to a lesser degree). Again the code I posted draws fine on Java 1.5, even with theta += 0.1.
For example, here's a version of the test code which only draws on whole-number increments and never places a vertex on the same pixel location twice...
- float lastX, lastY, angle;
- void setup() {
- size (600, 600, JAVA2D);
- strokeWeight(10);
- noFill();
- stroke(255);
- }
- void draw() {
- background (0);
- beginShape();
- for (float theta = 0; theta < angle % 360; theta += 0.1) {
- float x = 200 * cos(radians(theta)) + 300;
- float y = 200 * sin(radians(theta)) + 300;
-
- // Only draw vertex on whole increments,
- // never draw twice in the same location
- if ((lastX != int(x)) || (lastY != int(y))) {
- lastX = int(x);
- lastY = int(y);
- vertex(lastX, lastY);
- }
- }
- endShape();
- angle++;
- }
This creates similarly glitchy output:
The glitch can be isolated to the stroke drawing routines... filled shapes still draw cleanly. For example, if set noStroke() and draw with a fill instead, the same code (even with the 0.1 theta increment) draws just fine. Here's the slightly modified code:
- float angle;
- void setup() {
- size (600, 600, JAVA2D);
- fill(255);
- noStroke();
- }
- void draw() {
- background (0);
- beginShape();
- for (float theta = 0; theta < angle % 360; theta += 0.1) {
- float x = 200 * cos(radians(theta)) + 300;
- float y = 200 * sin(radians(theta)) + 300;
- vertex(x, y);
- }
- endShape();
- angle++;
- }
And the output:
I'm really at a loss.