PDA

View Full Version : color,material,texture.which work?



aQ
04-24-2005, 09:13 PM
color,material and texture all can set the outlooking of a plane,but if I use them together,how i will look like?
code for example
glColor4f(1.0,0.5,0.1,0.3);
glMaterialfv(GL_FRONT,GL_AMBIENT,MAmbient);
glMaterialfv(GL_FRONT,GL_DIFFUSE,MDiffuse);
than

glBindTexture(GL_TEXTURE_2D, texture[filter]);
glBegin(GL_QUADS);
glTexCoord2f(1.0,1.0);
glVertex3v(p1);
.................
glEnd();
how will they work

dorbie
04-24-2005, 11:11 PM
They all work together, exactly how depends on other settings, OpenGL is very flexible about how you can use these.

For example, glColorMaterial determines which material properties are affected by the vertex color (although really the color calls should come after the material has been specified).

The texture environment determines how the interpolated color is mixed with the texture color use glTexEnvi, the default is GL_MODULATE.

Other factors like an extension that allows a separate specular color interpolation mean you can optionally add the specular portion of lighting after texture has been applied to the color produced by the rest of the lighting calculation.

You can also make the material ignore vertex color, and you can make texture ignore the lighting result.

aQ
04-26-2005, 08:59 PM
thanks
gotit