PDA

View Full Version : Blending + Texturing



daviem01
08-20-2001, 12:51 PM
I'm working on a rather large and complex program right now and can't figure out how to make the next step work.

The program draws a series of 2-D geographical maps on a 3-D globe representation, on which is already drawn a vector map (country outlines, etc.) The texture images are stored in a class that contains all the important GL parameters, size, format and so on. (Right now the format is GL_RGB but that can be easily changed.) Because loading the images is so expensive in time and memory, only those in view at any one time are loaded; until then, the relevant data is stored in a "Texture Pool".

My problem is that I need to find a way to vary the intensity (alpha value) of the maps as they are drawn, to give varying levels of translucency. I am not sure how to do this using a texture, particularly when that texture's data cannot really be modified after initialization.

Any ideas as to how I'd go about doing this? The glClearColor is (0,0,0,0) and that can't be changed because of other GL routines.

Kaos
08-20-2001, 03:40 PM
Simple. Just give this a try.

glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_BLEND);
glColor4f(1.0f, 1.0f, 1.0f, alpha_level);

.... Draw quads/triangles/lines

glDisable(GL_BLEND);

daviem01
08-21-2001, 04:05 AM
Worked perfectly, exactly what I needed it to do-- thanks!


[This message has been edited by daviem01 (edited 08-21-2001).]