Color gradient with line-fill algorithm

I wrote a line-fill algorithm and for each line I set glColor3f() at the start point and glColor3f() at the end point, calculating the percentage of color required to acheive an even shade across the body of the polygon. This allows me to color shade at any angle I want.

It works great except for one problem: IT’S SOOOO SLOW. It takes 5 seconds for ONE polygon to render. This is because the poly is made up of approx. 400 lines, meaning over 800 calls to glVertex2f().

There MUST be a faster way to do this!! I can’t use display lists because I have to scale the poly for zooming in and out in my program.

HELP!!!

Wouldn’t this be an example where textures should be applied? Create the texture image with your ‘line filler’ once. Rendering then is really fast!

One word:

1D-Texture

Ok, that’s two words.