color make me confused

some code like this:
there is no glColorMaterial at all in all of my project.
if(method and 2)

	glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, m_AmbientDiffuse)
	glMaterialfv(GL_FRONT, GL_SPECULAR, m_Specular)
	glMaterialfv(GL_FRONT, GL_SHININESS, 0)
	glMaterialfv(GL_FRONT, GL_EMISSION, m_Emission)

else if(method == 0)

	glColor4f(0.1,0.3,0.8,0.6);


glPolygonMode(GL_FRONT,GL_FILL);
//here draw QUADS

the QUADS is always WHITE, even AmbientDiffuse, Specular, Emission are all 0.0?

there a two mode in my Draw one is just use color and no lighting; the other use material and lighting
why can’t this code work properly.

code is like this exactly
if(method && 2)
{
//glColor3f(1.0,1.0,1.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, m_AmbientDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, m_Specular);
glMaterialfv(GL_FRONT, GL_SHININESS, &( m_Specular[4]));
glMaterialfv(GL_FRONT, GL_EMISSION, m_Emission);
}
else if(method == 0)
{
glColor4f(0.1,0.3,0.8,0.6);
}

glPolygonMode(GL_FRONT,GL_FILL);
// here draw QUADS

it seems that color interfere the material or take the place of material.
how can I stop the glColor from affect the glMaterial?

You should look it up in the redbook to be certain, but I’m not sure you can.
If I remember correctly, glColor is equivalent to glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, m_AmbientDiffuse)

Apart from that, though, you have to remember that OpenGL maintains state. If you set the color using glColor in one object, that color will remain active until you replace it with another color.

Also, it would help if you told us what the value for “method” is.
By the way, you’re doing a check on “method && 2” - but that is not a bitwise AND, it is a logical AND. Which means that it’s only a check on whether or not “method” is non-zero.
If you want a bitwise AND, you should replace it with “method & 2”. But if you do, you should also realise that currently your comparisons will not fire when method=1/4/5/12/13 etc.

I believe that you want to show the colored polygon when method is equlivalent to 0–Yes?
If it’s the case, you should disable the lighting to get the correct result.
So:
if(method && 2)
{
//***Enable the lighting
glEnable( GL_LIGHTING );
//glColor3f(1.0,1.0,1.0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, m_AmbientDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, m_Specular);
glMaterialfv(GL_FRONT, GL_SHININESS, &( m_Specular[4]));
glMaterialfv(GL_FRONT, GL_EMISSION, m_Emission);
}

And:

else if(method == 0)
{
//***Disable the lighting
glDisable( GL_LIGHTING );
glColor4f(0.1,0.3,0.8,0.6);
}

-Ehsan-