Material Issue

Hi, Im making a 3D game for an assignment but am having an issue with my cube that I read in from a file + my DisplayHUD. Basically instead of using the colours from the file/HUD they are taking on the material that I used for a previous object. If anyone could shed some light onto why this is happening I would apreciate it, thanks.

[b]void displayHUD(){
char message[39];
char win[6];
sprintf(message, “W-Up S-Down A-Left D-Right R-Reset”);

glColor3f(1.0, 1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, 100, 0, 100);
outputText(5, 95, message);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}[/b]void display() {
char message[30];
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(cam.pos.x, cam.pos.y, cam.pos.z, cam.lookAt.x,
cam.lookAt.y, cam.lookAt.z,
cam.up.x, cam.up.y, cam.up.z);
glPushMatrix();
glTranslated(0, 4, 0);
glScalef(8, 1, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(0, -3, 0);
glScalef(8, 1, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(-3.5, 0.5, 0);
glScalef(1, 6, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(3.5, 0.5, 0);
glScalef(1, 6, 1);
glRotated(90, 0, 0 , 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(1.5, 0, 0);
glScalef(1, 1, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(1.5, -2, 0);
glScalef(1, 1, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(-2.5, -1, 0);
glScalef(1, 1, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(1.5, 2.5, 0);
glScalef(1, 2, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();
glPushMatrix();
glTranslated(-0.5, 1, 0);
glScalef(1, 3, 1);
setMaterial(&wallbox);
glutSolidCube(1.0);
glPopMatrix();

glPushMatrix();
glutKeyboardFunc(PlayerkeyPressed);
glTranslated(playerLocX, playerLocY, 0);
glScalef(1, 1, 1);
setMaterial(&playerbox);
glutSolidCube(1.0);
glPopMatrix();

glPushMatrix();
glTranslated(-2.5, 3, 0);
glScalef(0.999, 0.999, 0.999);
setMaterial(&finishbox);
glutSolidCube(1.0);
glPopMatrix();

glPushMatrix();
glTranslated(boxLocX, boxLocY, 0);
glScalef(1, 1, 1);
cube();
glPopMatrix();

displayHUD();
glFlush();
}

void init() {
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor3f(0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_/LIGHTING);
glEnable(GL_LIGHT0);
setLight(&whiteLighting);
wallBoundingBoxes();
read_file(“cube.txt”);

}

int main(int argc, char** argv) {
glutInitDisplayMode(GLUT_RGB |GLUT_DEPTH);
glutInit(&argc, argv);
glutInitWindowSize(500, 500);
glutCreateWindow(“Qubz”);
glEnable(GL_DEPTH_TEST);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
init();
glutMainLoop();
}

The bits in bold are taking on the material from the bit in red.

This isn’t my whole code, just the bits I thought matterd. If you need to see more let me know.