# strokeCap in P3D not working

**URL:** <https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633>\
**Category:** Processing\
**Created:** [September 2, 2020, 1:05pm UTC](https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633 "2020-09-02T13:05:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaaWaan](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@DaaWaan](https://discourse.processing.org/u/DaaWaan)\
**Post date:** [September 2, 2020, 1:05pm UTC](https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633/1 "2020-09-02T13:05:11Z")

</div>

Just for a background, I’m currently using P3D for 2D animations instead of the default, P2D, and FX2D because of performance issues that I get with the customization of strokes. I assume this probably has something to do with AMD graphics drivers and the fact that I have a relatively old laptop so I had no choice.

The downside that I got however is that I can only have a square strokeCap in P3D. The following is a sample demonstrating the strokeCaps:

```auto
void setup() {
    ...
    strokeWeight(10);
    stroke(255);
}
    
void draw() {
    background(0);
    strokeCap(PROJECT); line(50, 50, 200, 50);
    strokeCap(SQUARE); line(50, 100, 200, 100);
    strokeCap(ROUND); line(50, 150, 200, 150);
}

```

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a3f8ba0be30e818d6ff355ba57677c7df42344d3.png)

Is this behaviour by default or is this a bug? The documentation however doesn’t mention anything that strokeCaps don’t work in P3D

Further researching in google led me to discussions from the previous processing forum where it explains about this issue but I honestly do not understand the conclusion from these:

- [Trying to drawn lines with round ends [using strokeCap(ROUND)] in P3D mode, but they stay square](https://forum.processing.org/two/discussion/21075/trying-to-drawn-lines-with-round-ends-using-strokecap-round-in-p3d-mode-but-they-stay-square)
- [strokeCap(ROUND) failure](https://forum.processing.org/two/discussion/18718/strokecap-round-failure)
- [Lines in P3D only in rectangular mode](https://forum.processing.org/two/discussion/8967/lines-in-p3d-only-in-rectangular-mode)

Apparently, the discussions are also relatively old so I’m not sure if this has been fixed already.

---

<div class="post-metadata">

**Author:** ![DaaWaan](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@DaaWaan](https://discourse.processing.org/u/DaaWaan)\
**Post date:** [September 2, 2020, 1:31pm UTC](https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633/2 "2020-09-02T13:31:30Z")

</div>

Someone might suggest though that since this is only in 2D, I can just simply use `ellipse()` or `square()` at the points but they won’t really benefit in cases where the strokes are partially transparent ☹

---

<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:** [September 4, 2020, 2:41am UTC](https://discourse.processing.org/t/strokecap-in-p3d-not-working/23633/3 "2020-09-04T02:41:21Z")

</div>

Just experimenting…

```auto
void setup() 
  {
  size(640, 360, P3D);  
  }

void draw()
  {
  background(200, 0, 0);
  translate(width/2, height/2);
  rotateX(frameCount*TAU/500);
  rotateY(frameCount*TAU/500);
  
  float s = map(mouseX, 0, width, 5, 100);
  
  noStroke();
  fill(255, 255, 0, 150);
  arc(100, 0, s, s, -TAU/4, TAU/4, OPEN);
  arc(-100, 0, s, s, TAU/4, 3*TAU/4, OPEN);
  
  rectMode(CENTER);
  rect(0, 0, 200, s);
  
  //stroke(255, 255, 0, 100);
  //strokeWeight(50);
  //line(-100, 0, 100, 0);
  }

```

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/5047fc6cb363652f58a3c53686806878fb9d7102.png)
