I'm drawing a sphere and some ground. I used GL_POLYGON to draw a rectangle and colored it green. When I added a sphere, my ground just turned black. Is this because the sphere is a 3d object and the polygon is 2d or is there something else? Here is the code for my sphere and my ground, which are just in my display func.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Draw sphere
glPushMatrix();
glTranslatef (-4.0, 5.0, 0.0);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_ambient);
glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
glMaterialfv(GL_FRONT, GL_EMISSION, no_mat);
glutSolidSphere(.5, 50, 50);
glPopMatrix();
//ground
glMatrixMode(GL_PROJECTION);
glColor3f(0.0,1.0,0.0);
glBegin(GL_POLYGON);
glVertex3d(-8,-8,0);
glVertex3d(8,-8,0);
glVertex3d(8,-2,0);
glVertex3d(-8,-2,0);
glEnd();