Jump to content

  • Log In with Google      Sign In   
  • Create Account


jgg

Member Since 03 Sep 2011
Offline Last Active Sep 10 2011 07:34 AM

Posts I've Made

In Topic: Color transparency misunderstanding

06 September 2011 - 02:55 PM

Ok, thank you so much for your help!

In Topic: Color transparency misunderstanding

06 September 2011 - 02:48 PM

Right. And, just to know, is there a different blending function that automatically takes care of this?

In Topic: Color transparency misunderstanding

06 September 2011 - 02:34 PM

Thanks for your detailed explanaiton, Brother Bob. Setting this, for example:

glColor4f(1.0f, 1.0f, 1.0f, 0.85f);					
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
nearly produces the transparency effect I was expecting; I just miss one thing. As the cube is rotating, its sides change their position into the 3D space so, as they are repainted, some weird transparency behavior happens, like the back side being painted "over" the front side. It happens due to the order (always the same) in which the cube sides are painted in the DrawGLScene function, as the front side is the first in code, so every other side coming after will be painted over it. Am I wrong? In order to keep a "logic" transparency process while the cube is rotating, is there any other procedure different than calculating how sides should be repainted according to cube's position?

Thank you again.

In Topic: Color transparency misunderstanding

06 September 2011 - 11:27 AM

I understand that these lines enable blending so translucency effect happens, but it seems that the alpha value just changes the brightness of the color.

For example, in lesson 8, the blending enable code is like this:

glColor4f(1.0f, 1.0f, 1.0f, 0.5f);	// Full Brightness.  50% Alpha
glBlendFunc(GL_SRC_ALPHA,GL_ONE);	// Set The Blending Function For Translucency

If I set the alpha variable in glColor4f to 0.0f the cube becomes invisible, what makes sense as it should be completely transparent. However, when setting alpha to 1.0f, instead of having an opaque cube, it seems to be again 50% transparent but with lighter colors. I know that if I want to get opaque textures I just have to turn off blending (as it is shown in the same code of lesson 8), but what if I want to get a 33% or 85% transparency for example? Setting 0.33f or 0.85f in the 4th argument just makes the transparent cube lighter or darker, no effect on translucency at all.

Probably I'm missing something but, as I said before, I'm a complete newbie and I would like to learn with this; that's why I'm asking Posted Image.

Thank you so much for your help.

PARTNERS