View Full Version : fragment programs: secondary color?

05-23-2003, 10:20 AM
How to define a secondary color using OpenGL 1.4 (for an ATI Radeon 9700 pro)? I want to use it in my fragment program...

I know there is glSecondaryColorEXT but (apparently) it is only for OpenGL 2.1.

05-23-2003, 10:41 AM
Um... OpenGL 1.4 inherits anything that was in the past version.

I wouldn't rely on the version though, go by weather the extesnion is support or not.

05-23-2003, 11:39 AM
The secondary color is a per vertex attrib.
So, the first way which comes in mind to me is to use the vertex program attributes mechanism to specify it.

This information referres to ARB_v_p
Secondary color is generic attribute 4.
Standard gl sets it using SecondaryColorEXT.
In the vertex program, secondary color will come from vertex.color.secondary.
Processed secondary color goes in result.color.secondary (there are also other aliases but I would go for that one unless you need something special).

In ARB_f_p, the interpolated per-vertex secondary color will come from the fragment.color.secondary register.

Once it's there, do whatever you want.

Now, the point is that I don't remember what happens if secondary color extension is not supported... This should not be a problem since most 3d cards have it.

EDIT: vp input.

[This message has been edited by Obli (edited 05-23-2003).]