I can get the required effect from blending a dark color with my building textures to make it look like nighttime. However I don't understand why it works...
eg table 6.1 page 228 of the red book gives the blending fucntion parameters.
GL_ONE rgb factor=(1,1,1) alpha =1
Therefore if I want to blend my dark color with my texture - I can assume that the dark color is the source, the texture is the destination.
I have not specified an alpha color for each.
The blend function is:
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); ///THIS IS THE BLEND
glEnable(GL_TEXTURE_2D);
glEnable(GL_COLOR_MATERIAL);
glColor3f(0.1f, 0.1f, 0.1f);
glBindTexture(GL_TEXTURE_2D, buildingTex);
So according to page 226 the resultant color of say the red channel and the alpha after blending would be
(1*Rd + 1*Rs,...... 1*Ad+1*As)
which you would think would give a totally non transparent building with color channel equal to the combined value of 0.1 + the color channel.
Instead it's transparent.
I then tried
glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR)
which you would think would take the color of the glColor and combine it with the color of the building tex - but that blend too is transparent !
I don't get it !
So although I can get this to work with other values - the values that I would use from reading the red book don't do as I expect.
So can someone explain how to use the values and know what's going on so I can get it right and know why its right?
cheers
[Edited by - ade-the-heat on May 14, 2005 7:37:36 AM]