Lets say I have an image (in my case a jpeg) and I want to draw it with glDrawPixels…

if it is in color how do I go about drawing it in greyscale?

GL_LUMINANCE does not seem to work.
What I do is load the input image
Draw it with glDrawPixels()
Copy it with glReadPixels() (grabbing what ever component I want (rgb)
redraw it in another window…

what I want to do is either convert the image to greyscale outright

or copy the image and draw it in greyscale
(that is with only one component sybolizing the level of grey)

Could just do



found it the formula is


that is what tv does

ooops sorry, I think I am gong mad! :slight_smile:


Can u just do :

glColor3f((r+g+b) / 3,(r+g+b) / 3,(r+g+b) / 3);


Nope, that wouldn’t look good.