Rendering image on P3D, is it a bug?

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


2

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.

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.

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:

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?

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?

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

The bug report: please show your code first

1 Like