Hi,
I started using processing a few days ago and encountered a problem. In order to use Spout, I had to change renderer to P3D, but P3D lines/curves work a bit differently than in default renderer. There happens a bug in bend points. There seems to be no round strokeCap, I guess? Is there a way to prevent it and draw round line?
I’ve made a simple sketch showing the problem:
float x1, x2, x3;
float y1, y2;
float x = 0.0;
float amplitude = 200.0;
void setup(){
size(500, 400, P3D);
textureMode(NORMAL);
x2 = width/2;
y1 = height/2 + 100;
y2 = height/2 - 100;
}
void draw(){
background(0);
drawCurves(150, 30);
drawCurves(255, 10);
x += 0.01;
}
void drawCurves(float col, int size){
x1 = x2 + sin(x)*amplitude;
x3 = x2 - sin(x)*amplitude;
stroke(col);
strokeWeight(size);
strokeCap(ROUND);
noFill();
beginShape();
curveVertex(x1, y1);
curveVertex(x1, y1);
curveVertex(x2, y2);
curveVertex(x3, y1);
curveVertex(x3, y1);
endShape();
}
Bug:
mnse
July 29, 2022, 7:03pm
2
Hi @arTwirr ,
That is what processing 3 code says …
Don’t know why the doc generator not includes the info.
Cheers
— mnse
The P3D renderer doesn’t support strokeCap()
or strokeJoin() , which can lead to ugly results
when using strokeWeight()
1 Like
glv
August 1, 2022, 7:55pm
3
Hello,
Related topic:
https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633
@mnse ,
Please post a link to the source of this. Thanks.
:)
mnse
August 1, 2022, 8:09pm
4
Hi @glv ,
Permalink: Commented on PApplet.size description
Few lines below is also an issue link but it isn’t accessable anymore…
Cheers
— mnse
PS:
Now also found the related discussion on github issues:
opened 04:02PM - 10 Feb 13 UTC
closed 04:02PM - 10 Feb 13 UTC
imported
core
_Original author: b...@processing.org (June 07, 2010 01:06:51)_
This bug automa… tically added from:
http://dev.processing.org/bugs/show_bug.cgi?id=955
Comment from fry, 2008-10-17 07:42
With P2D, P3D, and OPENGL, series of connected lines (such as the stroke
around a polygon, triangle, or ellipse) produce unattractive results when
strokeWeight is set.
Need to implement proper stroke caps and joins. The math is nontrivial due
to edge cases, but anyone willing to help out, please do!
_Original issue: http://code.google.com/p/processing/issues/detail?id=123_
Most interresting part imo is this comment …
Have you tried P2D instead?