I am working on a project that is in GLES 1.1. It has to be GLES 1.1.
But it has to do some premultiplication i.e. get every pixel, and change it from rgba = r*a,b*a,g*a,a. And then later reverse it.
If i had access to shaders it would be no problem but of course being gles 1.1 I don't.
Doing it via readpixels and then doing it on the CPU and putting it back is horribly slow so I trying to think of someway i can cheat.
Now one way I could do the premultiply is by taking advantage of glTexEnvi
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_ALPHA);
but then afterwards, i need to reverse the operation. For the life of me I can not think of a way to reverse it.
If everything had the same alpha i could abuse the glLighting functions but sadly they do not.
I get the feeling i am a little doomed.
Perhaps i could just use shared contexts and do a snippet of GLES 2.0...but I feel that will come with its own overhead
if anyone has any ideas or thoughts on this at all I would greatly appreciate hearing them!