OCD 3D library - Everything is transparent (sort of)! Help!
in
Contributed Library Questions
•
1 year ago
Hi everyone,
Everything I draw when using the the OCD library (3d camera control) is "see-through". Not really transparent as when you set the alpha of the fill, but "see-through".
For example, a close-up cube does not block the view of a cube directly behind it but farther away. This is true when using the box, sphere, and line commands. It is also true when using the texture and vertex commands.
If I use the built-in camera command - no problems. I would like to use the OCD library for the camera navigation.
Any suggestions? Here's some example code:
import damkjer.ocd.*;
Camera camera1;
void setup() {
size(600, 400, P3D);
// position camera at z=-50
camera1 = new Camera(this, 0,0, -50, -10, 1000);
}
void draw() {
background(0);
// green cube at z=0 (should block view of the red cube)
fill(0, 200, 0);
addCube(0,0,0);
// red cube at z=100 (should not be visible since its behind the green cube)
fill(200,0,0);
addCube(0,0, 100);
camera1.feed();
}
background(0);
// green cube at z=0 (should block view of the red cube)
fill(0, 200, 0);
addCube(0,0,0);
// red cube at z=100 (should not be visible since its behind the green cube)
fill(200,0,0);
addCube(0,0, 100);
camera1.feed();
}
public void addCube(int x, int y, int z){
pushMatrix();
translate(x, y, z);
box(10);
popMatrix();
}
1