We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
OpenGL and Alpha (Read 979 times)
OpenGL and Alpha
Dec 13th, 2008, 2:53pm
 
Figured out another Problem using OpenGL:
Using several ellipse objects (fill with alpha) orientated along the z-axis and rotating them they only appear to be transparent from the front.
Trying the P3D renderer everything works fine.

Any suggestions?

Here's a code snippet:

Code:


import processing.opengl.*;

float spacer = 10.0;

void setup(){

size(400,400, OPENGL);

fill(255);
stroke(80);

rectMode(CENTER);
smooth();
}

void draw(){

background(0);

pushMatrix();
translate(width/2,height/2);
rotateY(frameCount*PI/60);
strokeWeight(2);

for(int i = 0; i <= 10; i++){
pushMatrix();
noStroke();
fill(30,100,20,50);
translate(0,0,-50+(i*spacer));
pushMatrix();
translate(0,0);
stroke(200,90,44);
rotate(radians(60));
ellipse( 0, 0, 50, 50);
popMatrix();

popMatrix();
}
popMatrix();
}

Re: OpenGL and Alpha
Reply #1 - Dec 13th, 2008, 5:36pm
 
Try changing the order in which the objects are drawn.  

That hack worked for me, but I'm sure there is a much better solution out there - OPENGL expert, anyone?
Re: OpenGL and Alpha
Reply #2 - Dec 13th, 2008, 6:43pm
 
this should work

hint(ENABLE_DEPTH_SORT);

fffff
Re: OpenGL and Alpha
Reply #3 - Dec 13th, 2008, 7:23pm
 
Wohooo! Works like a charm!
Thanks.
Re: OpenGL and Alpha
Reply #4 - Dec 13th, 2008, 7:55pm
 
Oh, hint(ENABLE_DEPTH_SORT); broke mine Sad
Page Index Toggle Pages: 1