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.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OpenGL alpha/transparency trouble
Page Index Toggle Pages: 1
OpenGL alpha/transparency trouble (Read 3600 times)
OpenGL alpha/transparency trouble
Jun 11th, 2010, 2:20pm
 
Continued from this topic, problems with rendering alpha in OpenGL;

Rapatsk1 wrote on Jun 11th, 2010, 1:48pm:
Also, I'm familiar with the basics of alpha. I only had major problems when applying them in the traditional way to opengl. Much like problems of smooth() in P3D, it seems like it doesn't actually make the lines transparent, but instead calculates their color based on the initial perspective. Stuff looks good, until you rotate the scene, and opaque lines in the color of the background obscure the scene. In the example of this sketch it isn't really easy to see, but I just tested it with alpha set to 100; zoomed all the way out you can see a difference in the appearance of the lines from different angles.

I'll try to setup a better example & post it to the opengl section of this forum.


Here some code that shows the problem:

Code:
import processing.opengl.*;
import javax.media.opengl.*;

float inclination = 0;
float azimuth = 0;

void setup() {

 size(600, 600, OPENGL);

 sphereDetail(150);
 
}

void draw() {
 
 background(255);

 translate(width/2, height/2);
 rotateY(azimuth);
 rotateX(inclination);

 noFill();
 stroke(0, 30);
 sphere(200);

 azimuth = (azimuth + 0.01)%TWO_PI;
 inclination = PI*sin(azimuth);
}
Re: OPENGL alpha/transparency trouble
Reply #1 - Jun 11th, 2010, 2:40pm
 
Alpha is working as expected for me.  Perhaps its a lighting or clipping thing.
Re: OPENGL alpha/transparency trouble
Reply #2 - Jun 11th, 2010, 2:51pm
 
alpha is not what he is talking about...
now i know what the problem is, just add hint(DISABLE_DEPTH_TEST)
to setup.

Re: OPENGL alpha/transparency trouble
Reply #3 - Jun 11th, 2010, 3:30pm
 
Aight! Explain?  Smiley
Re: OpenGL alpha/transparency trouble
Reply #4 - Jun 11th, 2010, 3:37pm
 
Quote:
Disable the zbuffer, allowing you to draw on top of everything at will. When depth testing is disabled, items will be drawn to the screen sequentially, like a painting. This hint is most often used to draw in 3D, then draw in 2D on top of it (for instance, to draw GUI controls in 2D on top of a 3D interface). Starting in release 0149, this will also clear the depth buffer. Restore the default with hint(DISABLE_DEPTH_TEST), but note that with the depth buffer cleared, any 3D drawing that happens later in draw() will ignore existing shapes on the screen.


i am not good at explaining Smiley but when drawing in 3d there is a zbuffer which stores where a shape is draw, so you dont have to draw stuff that is overlapped by other shapes. But when rotating and looking at it from behind, these shapes are not drawn. Hope that is almost right Smiley should be  faster when you enable the dephtest though
Re: OpenGL alpha/transparency trouble
Reply #5 - Jun 11th, 2010, 3:41pm
 
Just realized you are doing an internshop at field...
have fun working with marcus and vera-maria. they do great work!
Re: OpenGL alpha/transparency trouble
Reply #6 - Jun 11th, 2010, 3:42pm
 
Funny, I immediately tried it on the the text universe thingie, as I hoped it would fix the text artifacts, but instead all text gets drawn in the background. How's that?
Re: OpenGL alpha/transparency trouble
Reply #7 - Jun 11th, 2010, 3:44pm
 
Cedric wrote on Jun 11th, 2010, 3:41pm:
Just realized you are doing an internship at field...
have fun working with marcus and vera-maria. they do great work!


Haha yes, I will join them in july. Do you know them personally
Probably won't do Processing though. On to C++...  
Roll Eyes
Page Index Toggle Pages: 1