Lesson 8 question
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?
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.
And the alpha value should be 0.5, i think 0.2 is a typo.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
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?:) ).
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
Popular Topics
Advertisement