Jump to content
  • Advertisement

Archived

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

dani333

Alpha values for each vertex

This topic is 5167 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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!