Multiple light sources interacting

Hi,

Sorry, complete newbie here so please let me know if I’m barking up the wrong tree. I am currently working in OpenGL ES, specifically using the GLKit library, and I’m trying to assess if the following is possible or not.

I have a 2D scene comprised of multiple layer PNGs. There is a base layer image, which I have mapped directly from onto a quad, and then there are multiple other layer images with alpha-transparency which can be blended over the top using a linear dodge, giving the effect of different areas of the scene being lit-up. The layers need to be able to be turned on and off dynamically, with an animation effect where the alpha level tweens from 0 to 1, and back to 0 again. Multiple layers should be able to be ‘on’ at any one time.

GLKit seems to have two texture ‘slots’, which i can then blend using two GL_ONE’s, but I haven’t been able to get much further than this. How could I dynamically blend multiple textures over each, and have the ability to remove each texture on demand? Is this even possible?

Can anybody point me to some resources which might shed some light on this for me? :smiley:

Many thanks

I realise the post title doesn’t describe the problem particularly well… I tried editing it but it doesn’t show in the forum view.

Desperate for some advice on this problem, can anyone help?

I can’t help you directly because I don’t program in OpenGL ES. But you should be able to blend MAX_VERTEX_TEXTURE_IMAGE_UNITS textures manually in a shader and then blend the result with the frame buffer. If that is not enough textures then you will need to do multiple render passes

Thank you.

I will be working with approximately 6 to 8 separate layers, and I think I have up to 8 texture units on the device. So then it would be a case of simply changing the alpha value in glColor4f on each texture unit in order to make them appear and disappear?

That is how I see it. In the shader to blend out_colour = text_1_colour * text_1_colour_alpha + text_2_colour * text_2_colour_alpha + etc; or what ever formula you want for combining the textures. You might want to use a set of uniforms to control the visibility of each texture layer that way you don’t need to update the texture.