PDA

View Full Version : glSecondaryColor without alpha :-(



Daniel Dekkers
05-25-2009, 09:12 AM
Hi,

Is it just me or is it really a pitty that glSecondaryColor() doesn't support alpha. I have a large scene with lot's of vertex arrays or VBO's including color arrays. I would like to fade the whole scene by adding an alpha parameter to the render function without having to update the color arrays. I hoped that glSecondaryColor() could do the trick (because i'm not using any lighting at the moment), but no such luck. I tried doing the multiplication myself with glSecondaryColor3f(R*A, G*A, B*A) which gives the correct color, but blending fails because you don't actually modify the alpha values.

Does anyone know an easy sollution for this or do i have to solve it in the shaders?

Kind Regards,

Daniel Dekkers

skynet
05-25-2009, 09:29 AM
You may use glBlendColorEXT() in conjuction with
glBlendFunc(GL_CONSTANT_ALPHA_EXT, GL_ONE_MINUS_CONSTANT_APHA_EXT).

This way you can control the blend factor for the whole geometry without having to fiddle with material or light colors. The only drawback is that you only have one alpha value for the whole batch.