View Full Version : Alpha scaling with fixed-func OpenGL

01-27-2009, 12:23 PM

I'm working on a renderer using exclusively a premultiplied alpha blending function GL_ONE:GL_ONE_MINUS_SRC_ALPHA. I need to support programmable as well as fixed-func hardware.

My current problem is that I need to scale the color vectors of a vertex array given a floating point number between in the range [0.0:1.0]. That number defines the opacity of the set of primitives to be rasterized. The formula used is the standard premultiplied alpha one: [R',G',B',A'] = [Ra,Ga,Ba,a]. The thing is that I'd like to avoid processing my vertices using the CPU.

When vertex shaders are supported I can write a simple vertex shader to do that. The question is do you know a way to accomplish that task using the GPU with fixed-func hardware?

01-27-2009, 02:45 PM
Yes, you can use a texture unit (or combiner) to modulate with a color vector. With combiners this can be set using the available attributes without using a texture image fetch, otherwise use a 1x1 texture and mudulate.

01-28-2009, 02:26 AM
Oh right, thanks for your help.