Sign in to follow this  
Mr Awesome

Grayscale and Alpha Rendering

Recommended Posts

Mr Awesome    106
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
Guest Anonymous Poster   
Guest Anonymous Poster
why not make glGrayscale2ubv() yourself and have it call glColor3ub()

Share this post


Link to post
Share on other sites
Mr Awesome    106
Yes, I could do that, but it would be much better to use OGL's way of doing it. But, since you are sort implying that there isn't a way, I guess I'll have to go that route.

Share this post


Link to post
Share on other sites
deavik    570
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
JohnBSmall    881
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