PDA

View Full Version : Color gradient with line-fill algorithm



aelius
08-21-2003, 11:32 AM
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!!!

kschroed
08-22-2003, 05:33 AM
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!

1234!
08-22-2003, 04:45 PM
One word:

1D-Texture

Ok, that's two words.