I could not install QueasyCam (it fails) so I tried with PeasyCam
import peasy.*;
PeasyCam cam;
PShape box;
PShape sphere;
public void setup() {
fullScreen(P3D);
cam = new PeasyCam(this, 400);
box = createShape(BOX, 100.0f);
sphere = createShape(SPHERE, 50.0f);
box.setStroke(false);
box.setFill(color(255, 0, 0, 100));
sphere.setStroke(false);
sphere.setFill(color(255, 0, 0, 100));
noStroke();
fill(0, 0, 255, 100);
}
public void draw() {
background(255);
// Just to be sure
hint(ENABLE_DEPTH_TEST);
hint(ENABLE_DEPTH_MASK);
// Magic line that should all correct
hint(ENABLE_DEPTH_SORT);
for(int i=0; i<2; i++) {
translate(0, 0, i*200);
pushMatrix();
translate(100, 100, 0);
sphere(50);
translate(-200, 0, 0);
box(100);
translate(0, -200, 0);
shape(box);
translate(200, 0, 0);
shape(sphere);
popMatrix();
}
}
For me too the shapes created with createShape
behave different from those drawn directly.
But even when dealing only with shapes drawn directly the transparency works only sometimes, depending on the rotation.