Display Lists

Hello
I’m working on a science-presetation project for school, and to make my program a bit more faster i decided to use display lists.
But after making the third display list, it’s acting so weird, cus one time it draws what it supposed to draw and the second time just my desktop and so on.
I first allocate memory for the 6 display lists:

       	list_index = glGenLists(6);

So when i create the following displaylist, it’s all ok:

	glNewList(list_index, GL_COMPILE);
	{
	glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_color);
	glMaterialfv(GL_FRONT, GL_SPECULAR, lightcolor);
	float color1[4];
	color1[0] = cube_color[0] / 20 + lightcolor[0] / 20 + 0.3;
	color1[1] = cube_color[1] / 20 + lightcolor[1] / 20 + 0.3;
	color1[2] = cube_color[2] / 20 + lightcolor[2] / 20 + 0.3;
	color1[3] = 1.0;
	glMaterialfv(GL_FRONT, GL_AMBIENT, color1);
	}
	glEndList();
	
	glNewList(list_index+1, GL_COMPILE);
	{
	glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_color);
	glMaterialfv(GL_FRONT, GL_SPECULAR, lightcolor);
	float color2[4];
	color2[0] = sphere_color[0] / 20 + lightcolor[0] / 20 + 0.3;
	color2[1] = sphere_color[1] / 20 + lightcolor[1] / 20 + 0.3;
	color2[2] = sphere_color[2] / 20 + lightcolor[2] / 20 + 0.3;
	color2[3] = 1.0;
	glMaterialfv(GL_FRONT, GL_AMBIENT, color2);
	}
	glEndList();

But when i add another display list, in my case the next display list is:

	glNewList(list_index+2, GL_COMPILE);
	{
	glMaterialfv(GL_FRONT, GL_DIFFUSE, other_cube);
	glMaterialfv(GL_FRONT, GL_SPECULAR, lightcolor);
	float color3[4];
	color3[0] = other_cube[0] / 20 + lightcolor[0] / 20 + 0.3;
	color3[1] = other_cube[1] / 20 + lightcolor[1] / 20 + 0.3;
	color3[2] = other_cube[2] / 20 + lightcolor[2] / 20 + 0.3;
	color3[3] = 1.0;
	glMaterialfv(GL_FRONT, GL_AMBIENT, color3);
	}
	glEnd();

it’s acting really weird(as i already told).
so can anyone see what is causing the problem?
Thanx Hylke

I just figured out that the problem was glEnd it needs to be glEndList.
Hylke