• Advertisement
Sign in to follow this  

Grayscale and Alpha Rendering

This topic is 4362 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

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

Share this post


Link to post
Share on other sites
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
Uh... there's a glColor4ubv() function:
void glColor4ubv(const GLubyte *v);

Is that what you're looking for?

John B

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
Sign in to follow this  

  • Advertisement