View Full Version : Applying/mixing material and texture
03-01-2012, 10:46 AM
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?
03-01-2012, 10:58 AM
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
2. 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 ?
03-01-2012, 01:58 PM
Thanks for the info, enlightening, I can't wait to try it out. :)
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.
03-01-2012, 03:05 PM
Just playing around with it, seems to work but now the lighting has no effect.
03-01-2012, 03:14 PM
You must use white then.
03-01-2012, 03:15 PM
For lighting I think you have to use GL_Modulate.
That's why using shaders is sooooo much better!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.