Seeking the best way to brighten texture-mapped quads… I’m using glDrawArrays (fixed pipeline vs. shader) with color arrays included. My sprites are composed of multiple png-based textures that are premultiplied to get rid of halos, etc.
I want to highlight them when the user is supposed to touch them (for example). I can darken them using the color arrays, but I do not know how to brighten them without causing them to become semi-transparent where they should not (see image).
Since the color arrays didn’t seem to work for this (seems like they should?) I tried a different approach, but it didn’t work out quite right.
My first hack at this was to call glDrawArrays a 2nd time with a different blend function. The images above used the following code, but no matter how I change the blend function for the 2nd glDrawArrays I can’t get both brightening without unwanted transparency where it should not be.
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLES, 0, 6 * (TextureArrayIndexEnd - TextureArrayIndexStart));
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDrawArrays(GL_TRIANGLES, 0, 6 * (TextureArrayIndexEnd - TextureArrayIndexStart));
Oh, and this is in effect:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
Each sprite is composed of between ~10 texture-mapped quads.
Before brightening attempt it looks like this:
After brightening attempt it looks like so (note the bodies becoming transparent where they shouldn’t):
My approach here seems like a hack and I’m not sure it gives me the control I’m seeking (ie. basically what the color arrays provide for darkening, but for brightening instead). What I’m hoping to hear is that there is some way to actually use the color arrays to brighten as well as darken my texture mapped quads that is also compatible with premultiplied textures…
Is this doable?