🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lesson 8 question

Started by
1 comment, last by TNDenton 18 years, 1 month ago
At the end of lesson 8 NeHe says something like... "But how can we specify the color if we are using a texture map? Simple, in modulated texture mode, each pixel that is texture mapped is multiplied by the current color. So, if the color to be drawn is (0.5, 0.6, 0.4), we multiply it times the color and we get (0.5, 0.6, 0.4, 0.2) (alpha is assumed to be 1.0 if not specified). " I'm going to assume that "modulated texture mode" is just a fancy way of saying textures with blending. Does that sound right? And how does the outcome (0.5, 0.6, 0.4, 0.2) fit into the blending equation? I'm not clear as to how the alpha value became 0.2. Does anyone know?
Advertisement
Modulated texture mode means that you multiply the texture color and the color(set with glcolor) to get a new color, so yes it's a form of blending, but don't confuse it with the glBlendFunc type of blending.

And the alpha value should be 0.5, i think 0.2 is a typo.
The problem with NeHe's lesson 8 is that the blending equation is for GL_SRC_ALPHA as source blend factor and GL_ONE_MINUS_SRC_ALPHA as destination blend factor, but in code sample glBlendFunc() gets GL_SRC_ALPHA (As, As, As, As) and GL_ONE (1,1,1,1).

Change GL_ONE to GL_ONE_MINUS_SRC_ALPHA, glColor4f give 100% Alpha, and you will see that box's front face is truly 'totally opaque' (and not only this - see what happens while rotating the box - nice, isn't it?:) ).

This topic is closed to new replies.

Advertisement