PDA

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)

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

r=g=b=greyscale_level;

gav

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

.30r+.59g+.11b

that is what tv does

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

gav

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

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

???

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