PDA

View Full Version : Greyscaling an image in GLES 1.x



Lucretia
08-14-2011, 04:51 AM
Hi,

I have a need to make parts of an image dynamically greyscale.

I was thinking about using a small quad with a grey texture or just grey vertex colours and then blending that with the colour image in some way, but I don't know which blend function to use for this, could someone point me in the right direction?

Thanks,
Luke.

uruk
08-14-2011, 10:11 AM
A simple method is (R,G,B) dot3 (0.3,0.3,0.3).

Lucretia
08-14-2011, 05:48 PM
aparently, that doesn't work under Android...I have had a play and it made no difference.

BionicBytes
08-15-2011, 03:21 AM
Can you not modulate the texture with a grey-scale texture?

Failing that there are options depending what's supported:
glTexEnv (http://www.khronos.org/opengles/sdk/1.1/docs/man/glTexEnv.xml)
You may be able to use DOT3 if you have support for it.