Sign in to follow this  
yahn

Color in OpenGL

Recommended Posts

Is there any sort of standard struct/class for colors in C++? I ask only because I'm working on an engine and I want it to be as standards compliant as possible. Would it be better to just leave coloring to 3 floats, or to use a preexisting library?

Share this post


Link to post
Share on other sites
I said the wrong thing, but I think it is going to be the same answer either way. I meant to say if there is a way of dealing with this specifically with OpenGL. I don't want to have my program built on top of a class if there is already one that everyone is using, I'd rather use that. But since it is so simple, I figure there probably is no standard class.

Edit: Do you think I should include the alpha with the color? I thought it was a good idea at first, but then I thought that a lot of times you want to keep the same color and draw it at different alphas, but then I thought it isn't very difficult to change the alpha in this theoretical class.

Share this post


Link to post
Share on other sites
Sometimes you will want an alpha, sometimes you won't. Just use 1.0 for alpha in cases where you don't need to set it to anything else. But most of all, don't overthink this trivial issue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this