Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
ginpbs
ginpbs's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Transparency problem
[3 Replies]
16-May-2012 10:13 AM
Forum:
Programming Questions
Hi everyone i'm new on processing, and I can't get a good trasparency effect, if you try my example you will notice that where the spheres intersect the transparency is not always working. Can be solved? what i'm doing wrong?
Thanks .
import processing.opengl.*;
float rotation=0;
void setup() {
size(800, 800, OPENGL);
background(255);
smooth();
}
void sensor_position(int number){
noStroke();
pushMatrix();
if (number==1){
fill(0,255,0,255);
translate(12.5,+12.5,-12.5);}
if (number==2){fill(255,0,0,255);
translate(12.5,+12.5,+12.5);}
if (number==3){ fill(0,0,255,255);
translate(-12.5,+12.5,0);}
sphere(1);
popMatrix();}
void draw() {
background(255);
//lights();
float orbitRadius= 50;//mouseX/2+50;
float rotation=mouseX;
float ypos= 20+mouseY/5;
float xpos= cos(radians(rotation))*orbitRadius;
float zpos= sin(radians(rotation))*orbitRadius;
camera(xpos, ypos, zpos, 0, 0, 0, 0, -1, 0);
noFill();
stroke(0);
box(25);
sensor_position(1);
sensor_position(2);
sensor_position(3);
fill(0,255,0,20);
noStroke();
pushMatrix();
translate(12.5,+12.5,-12.5);
sphere(20);
popMatrix();
fill(255,0,0,20);
pushMatrix();
translate(12.5,+12.5,+12.5);
sphere(20);
popMatrix();
fill(0,0,255,20);
pushMatrix();
translate(-12.5,+12.5,0);
sphere(20);
popMatrix();
}
«Prev
Next »
Moderate user : ginpbs
Forum