• Advertisement
Sign in to follow this  

Lesson 8 question

This topic is 4341 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?:) ).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement