# Problem with lines/curves in P3D

**URL:** <https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151>\
**Category:** Beginners\
**Created:** [July 29, 2022, 5:32pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151 "2022-07-29T17:32:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arTwirr](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@arTwirr](https://discourse.processing.org/u/arTwirr)\
**Post date:** [July 29, 2022, 5:32pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/1 "2022-07-29T17:32:50Z")

</div>

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:

```auto
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:

 ![processingproblem](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/3/c/3cc7a2419abdc0041650ee027690119e6c3e69aa.png)

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [July 29, 2022, 7:03pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/2 "2022-07-29T19:03:47Z")

</div>

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()**

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 1, 2022, 7:55pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/3 "2022-08-01T19:55:53Z")

</div>

Hello,

Related topic:  
[https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633](https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633)

> [@mnse](#):
>
> The P3D renderer doesn’t support **strokeCap()**  
> or **strokeJoin()**, which can lead to ugly results  
> when using **strokeWeight()**

@mnse,

Please post a link to the source of this. Thanks.

`:)`

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [August 1, 2022, 8:09pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/4 "2022-08-01T20:09:39Z")

</div>

Hi @glv,

[Permalink: Commented on PApplet.size description](https://github.com/processing/processing/blob/8b15e4f548c1426df3a5ebe4c2106619faf7c4ba/core/src/processing/core/PApplet.java#L1971)

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:

> <https://github.com/processing/processing/issues/162>
>
> \_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](https://github.com/processing/processing/issues/162#issuecomment-13352278) …

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [August 2, 2022, 2:31pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/5 "2022-08-02T14:31:36Z")

</div>

Have you tried P2D instead?

---

<div class="post-metadata">

**Author:** ![arTwirr](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@arTwirr](https://discourse.processing.org/u/arTwirr)\
**Post date:** [August 4, 2022, 2:58pm UTC](https://discourse.processing.org/t/problem-with-lines-curves-in-p3d/38151/6 "2022-08-04T14:58:32Z")

</div>

Yes, the same result
