Problem with transparency
in
Programming Questions
•
1 year ago
Hi, once more!
The 2nd thing I'm not able to solve (although I've tried to make sense of the documentation) is transparency. The following code ought to display a semy-transparent sphere containing a box penetrating the sphere with its edges:
void setup() {
size (400,400,OPENGL);
}
void draw() {
directionalLight ( 128,128,128, -1,1,-1);
translate(width/2,height/2,0);
noStroke();
// 4th parameter is opacity
fill(128,128,255, 32);
sphere (100);
fill(255,255,255);
rotateX(PI/4);
box(135);
}
But no matter what value I use for opacity (this holds for floats between 0.0 and 1.0), the sphere remains opaque. To insert the box into the scene first doesn't make any difference, too.
Any kind of hint would be highly appreciated!
Regards from Vienna/Austria
phaidros
The 2nd thing I'm not able to solve (although I've tried to make sense of the documentation) is transparency. The following code ought to display a semy-transparent sphere containing a box penetrating the sphere with its edges:
void setup() {
size (400,400,OPENGL);
}
void draw() {
directionalLight ( 128,128,128, -1,1,-1);
translate(width/2,height/2,0);
noStroke();
// 4th parameter is opacity
fill(128,128,255, 32);
sphere (100);
fill(255,255,255);
rotateX(PI/4);
box(135);
}
But no matter what value I use for opacity (this holds for floats between 0.0 and 1.0), the sphere remains opaque. To insert the box into the scene first doesn't make any difference, too.
Any kind of hint would be highly appreciated!
Regards from Vienna/Austria
phaidros
1