This topic is now archived and is closed to further replies.


change color of polygon

Recommended Posts

Hi How would I go about changing the color of a polygon. I want to be able to change it using a keystroke. Take for example that I have 6 colors defined. I want it to loop through them as I hit a key Appreciate it very much Thanks

Share this post

Link to post
Share on other sites
Willbo    139
Go to and check out the lessons section. You'll find out how to change colors of polygons there, and even how to texture them.
Every tutorial comes with full source too!
To change the color of a polygon you could simply use the glColor function
glColor4f( Red, Green, Blue, Alpha );
every value is in range from 0.0 (lowest) up to 1.0 (highest)
or, if you prefer the 0-255 range version, just use
glColor4ub( Red, Green, Blue, Alpha );

- Patrik Willbo

The Lord says He can get me out of this mess, but He's pretty sure you're fucked.
- Stephen (Braveheart)

[edited by - Willbo on April 29, 2003 12:54:08 PM]

Share this post

Link to post
Share on other sites