# Rendering image on P3D, is it a bug?

**URL:** <https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367>\
**Category:** Coding Questions\
**Created:** [June 28, 2019, 11:02pm UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367 "2019-06-28T23:02:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GuilhermeVolker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/guilhermevolker/32/5657_2.png) [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Post date:** [June 28, 2019, 11:02pm UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/1 "2019-06-28T23:02:19Z")

</div>

I have this problem (show on the first image) that one arc is overlaping other image bellow, i did try to translate `translate(0,0,1);` it should work just fine but insted i have this very wierd result (2° image). That looks like a bug, right?  
By the way, i am using P3D to render some images for performance reasons

1°  
 ![1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/5c67ce6b6dfcd5827f27ac0801c9ac230674f9bf.png)

2°  
 ![2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9b228c9e8a11b27337f64ea4f009f71acff18e07.png)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [June 29, 2019, 8:43am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/2 "2019-06-29T08:43:11Z")

</div>

```auto
void setup() {
  size(300,300,P3D);
  noStroke();
}

void draw() {
  background(200,200,0);
  translate(width/2,height/2,0);
  fill(200,0,0);
  rect(0,0,100,100);
  translate(0,0,-1); // this hides the following rectangle even it is drawn later
  fill(0,200,0);
  rect(-10,-10,50,50);
}

```

so. my idea is you need to check on the

- z position

AND

- drawing order

of each object.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 30, 2019, 3:19am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/3 "2019-06-30T03:19:43Z")

</div>

You can set a hint for depth checking.

However, is this really a set of 3D layers, or do you just want to display a 2D image in 3D space? If the later, just create a 2D PGraphics, draw on it as normal, then display with image in your 3D space. No weird z-hacking required.

---

<div class="post-metadata">

**Author:** ![GuilhermeVolker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/guilhermevolker/32/5657_2.png) [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Post date:** [July 1, 2019, 12:27am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/4 "2019-07-01T00:27:15Z")

</div>

Yeah, i did try to use P2D but the images are shaking, like a vibration, very strange for me. When i try the P3D i have this another strange behavior. If you would like to see, here is a github link of the code:

> **[GuilhermeVolker/-main-0.6](https://github.com/GuilhermeVolker/-main-0.6)**
>
> Contribute to GuilhermeVolker/-main-0.6 development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [July 1, 2019, 2:16am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/5 "2019-07-01T02:16:05Z")

</div>

```auto
size(1200,700,P2D);

```

Hmm. Is your whole sketch 3D, but with a 2D layer? Or is it just a 2D sketch?

If it is 2D, why are you using the OpenGL-based P3D or P2D at all – why not use the default JAVA2D?

---

<div class="post-metadata">

**Author:** ![GuilhermeVolker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/guilhermevolker/32/5657_2.png) [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Post date:** [July 1, 2019, 2:39am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/6 "2019-07-01T02:39:07Z")

</div>

On the full code I had problem with low fps, was like 9 to 12 FPS. The solution I found was to use P2D, as you saw the P2D doesn’t work fine… With P3D I had these another problem on the images.  
But the sketch is only on 2D  
I forgot to mention that, sorry.

But about the images vibration, do you think I should report that as a bug?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [July 1, 2019, 8:48am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367/7 "2019-07-01T08:48:06Z")

</div>

It was a little confusing that you mentioned P3D but it wasn’t really.

The bug report: please show your code first
