Applying/mixing material and texture

When I give a model a green material and apply a texture to it, only the green pixels are shown.


Model with white material


Model with green material

  1. Are textures always blended with materials this way?
  2. Can textures completely overwrite materials?

TIA

  1. The default being GL_MODULATE, yes, unless you ask differently with a different texenv mode :
    glTexEnv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); /* or GL_REPLACE */

Read this for details : http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

  1. yes, with GL_REPLACE. With GL_DECAL however any transparent part of the texture will let through the original material.

BTW, why using green material if you want white ?

Thanks for the info, enlightening, I can’t wait to try it out. :slight_smile:

I used a green material as a place-holder for development before adding a texture.

I used a white material for debugging.

Since I’m using a texture, I’d rather not use any material, but if the texture were to over-write it, it wouldn’t matter which material I was using.

Just playing around with it, seems to work but now the lighting has no effect.

You must use white then.

For lighting I think you have to use GL_Modulate.
That’s why using shaders is sooooo much better!