Blending Question?

I am creating a 2d heightfield, I wish to import a picture of a map(done), then draw a grid over the top(done).

But I also wish to make both map & the grid user transparent, via a slider.

I have the slider control implemented, I simply wish to know how you would make both the grid and pictures transparency gradually change with the manipulation of the slider control?

I assume you are displaying the map by drawing a textured polygon. If this is the case, simply set the texture mode to modulate with glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) and use glColor4f(r,g,b,a) to set the alpha value of the polygon.

Hope that’s what you meant.


That is a fudge, as it only works if the background is the same colour as the quad!

What if I am blending over another Images does this mean if I require user transparency
I will have to edit the alpha of each pixel before drawing!