Archived

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

Alpha values for each vertex

This topic is 4983 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, How to specify alpha values for each vertex of the quad when i''m drawing (with glColor4f() for example)?.

Share this post


Link to post
Share on other sites
Every vertex will use the current color, texture coordinate and normal when glVertex* is called.
glColor4fv(color1);
glVertex3fv(vertex1); // Will use color1 (and its alpha)

glColor4fv(color2);
glColor4fv(color3);
glVertex3fv(vertex2); // Will use color3

Note that in the above example, the second vertex will use color3, since that''s the last color set with glColor* before the glVertex* call.

So to set different alpha values for each vertex, just add a call to glColor* before each glVertex*.

Share this post


Link to post
Share on other sites