View Full Version : jpegs

09-07-2000, 01:31 PM
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)

09-08-2000, 12:28 AM
Could just do



09-08-2000, 07:00 AM
found it the formula is


that is what tv does

09-08-2000, 10:46 AM
ooops sorry, I think I am gong mad! :-)


09-11-2000, 12:58 AM
Can u just do :

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


09-11-2000, 01:17 AM
Nope, that wouldn't look good.