color change problem

i drew a floor with

void drawFloor()
{
glColor3f(0.0f, 0.7f, 0.0f);
glBegin(GL_QUADS);

  glVertex3f(-100.0f, 0.0f, -100.0f);
  glVertex3f(-100.0f, 0.0f,  100.0f);
  glVertex3f( 100.0f, 0.0f,  100.0f);
  glVertex3f( 100.0f, 0.0f, -100.0f);

glEnd();
}

but when i complie and run it, a black surface appear then it turn red after awhile. is there somthing wrong with my light setting?

void init(void)
{
GLfloat mat_ambient[]={0.2, 0.2, 0.2, 1.0};
GLfloat mat_diffuse[]={0.8, 0.8, 0.8, 1.0};
GLfloat mat_specular[]={1.0, 1.0, 1.0, 1.0};
GLfloat mat_shininess[]={100.0};
GLfloat light_position[]={1.0, 1.0, 1.0, 0.0};
GLfloat light_ambient[]={0.0, 0.0, 0.0, 1.0};
GLfloat light_diffuse[]={1.0, 1.0, 1.0, 1.0};
GLfloat light_specular[]={1.0, 1.0, 1.0, 1.0};
GLfloat lmodel_ambient[]={0.1, 0.1, 0.1, 1.0};
glClearColor(0.0, 0.6, 1.0, 1.0);
glShadeModel(GL_SMOOTH);

glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);

}

You need to define normals for your vertices. Looks like they should be either 0,1,0 or 0,-1,0 for your quad. The default normal is 0,0,1. Of course, the current normal is the last normal specified.

Once you do that you should also be aware that GL lighting looks better when there are a greater number of vertices. Try a 2x2 grid as well as a 4x4 grid and see the difference then decide if you need or want more. You may be satisfied with the 1x1…

Hope that helps

thanks alot shinpaughp! that was it.
ok now i want to set my floor color to be green and my model to be red, but y the color of floor and background appear the same?

when lighting is enabled, glColor* have no effect. you have to use glMaterial instead or use glColorMaterial.