jpegs

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…
with glDrawPixels()

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)

This has been previously answered in here by “mr x”. Anyway that’s what he says:

"

.30r+.59g+.11b

that is what tv does
"

Antonio www.fatech.com/tech

You are able to specify with glTexImage2D the format the existing data is in, and the desired format you want it to be as seen by GL, but I don’t think you get the desired conversion out of it.

Usualy you preprocess your images before introducing them to GL as Antonio suggests. But if you must use glDrawPixels, process the image data before calling it, do not do the “draw copy redraw” method you were talking about for it is not needed.

/skw|d

OpenGL has a method to map a channel of a texture to another channel, this can work for you if you just want to map only one channel to the luminance channel (yes, luminance is considered a channel in OGL, sometimes), but i think there’s a way to even combine the three channels with the same function