When I draw an object with a texture attached to it (GL_RGB8) and I make it transparent by modulating the texture with an alpha color e.g. glColor4f(1,1,1,0.5);
the object gets transparent only when I have disabled GL_LIGHTING. When I turn on lights the objects becomes opaque.
Does anyone have any idea why this happens?
When lighting is enabled, the alpha for your primary color at each vertex comes from the alpha component of the diffuse material color.
So set the alpha of your diffuse material to 1.0 if you want opaque and 0.5 (or whatever) if you want transparent.
Thanks it Worked.
I have another question now. What values should I put to the LIGHT ATTENUATION parameters to emulate an omni positional light of radius “X” ? (objects outside light sphere should not be lit)