# How can I 3d rotate a shape while using size(P2D)?

**URL:** <https://discourse.processing.org/t/how-can-i-3d-rotate-a-shape-while-using-size-p2d/29134>\
**Category:** Coding Questions\
**Created:** [April 5, 2021, 12:29pm UTC](https://discourse.processing.org/t/how-can-i-3d-rotate-a-shape-while-using-size-p2d/29134 "2021-04-05T12:29:58Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [April 5, 2021, 2:22pm UTC](https://discourse.processing.org/t/how-can-i-3d-rotate-a-shape-while-using-size-p2d/29134/4 "2021-04-05T14:22:20Z")

</div>

ahah I just posted the same answer a minute ago! 😉

> [@Mix 2d and 3d drawings](https://discourse.processing.org/t/mix-2d-and-3d-drawings/29125/2):
>
> Hi @KelvinLamptey , Welcome to the forum! wink Drawing 2d shapes in 3d mode is not specific to Android so the following code also works in Processing Java. In order to do that, you need to draw your 3d shapes on a separate [PGraphics()](https://processing.org/reference/PGraphics.html) buffer that you can then display on your 2D canvas. Doing the opposite doesn’t work since drawing an image in 3d space is going to intersect with the 3d shapes you draw. float angle = 0; PGraphics canvas3D; void setup() { size(300, 300, P2D); canvas3D =…

---

_[View the full topic](https://discourse.processing.org/t/how-can-i-3d-rotate-a-shape-while-using-size-p2d/29134)._
