Sign in to follow this  
Mr Awesome

Grayscale and Alpha Rendering

Recommended Posts

This might be a stupid question, but how would you go about rendering an array of a grayscale value and an alpha value? Is glColor3ub(ga[0], ga[0], ga[0], ga[1]) the only way to do it? It would be much more convenient to have a function like glGrayscale2ubv(ga).

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBSmall
Uh... there's a glColor4ubv() function:
void glColor4ubv(const GLubyte *v);

Is that what you're looking for?

John B

I think he's looking for a function that will repeat the rgb values for a grayscale color. [smile]

Personally I think, yes you should write an inline function that takes intensity + alpha, calls glColor4* with (intensity/3, intensity/3, intensity/3, alpha)

/edit: If you are using shaders BTW, it will possibly be faster with a shader and more elegant.

Share this post


Link to post
Share on other sites
Quote:
Original post by deavik
Quote:
Original post by JohnBSmall
Uh... there's a glColor4ubv() function:
void glColor4ubv(const GLubyte *v);

Is that what you're looking for?

John B

I think he's looking for a function that will repeat the rgb values for a grayscale color. [smile]

Oh, right. My bad.

John B

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