Texture and animation = problems

i am using glut and the ‘popular idle function’ for animation. It works pretty good, unless i want to add a background picture. It is an image with the size 1024 * 1024 and the whole program works when only the first picture is done (that means i can see the background and the 3D Object in front of it). But when i enable the idle function the background pic is erased by the ClearColor and i see only the 3D Objects moving…then the program hangs up after some seconds of animation.

The first lines of my display function that produce the background are:

void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//-------------------------------------------(background)

glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0.0,1.0,0.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthMask(GL_FALSE);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 0.0);
glTexCoord2f(1.0, 0.0); glVertex2f(1.0, 0.0);
glTexCoord2f(1.0, 768.0/1024.0); glVertex2f(1.0,1.0);
glTexCoord2f(0.0, 768.0/1024.0); glVertex2f(0.0, 1.0);
glEnd();
glDepthMask(GL_TRUE);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glDisable(GL_TEXTURE_2D);

//-------------------------------------------(background)

Here are some lines of the code in the init() that are used for texture mapping.
Please consider that the first picture is produced correctly.

void init(void)
{
bitm_info = _bitmap(“e:\back.bmp”);
glGenTextures(1, &texName);
glBindTexture(GL_TEXTURE_2D, texName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, bitm_info.width, bitm_info.height,
0, GL_BGR_EXT, GL_UNSIGNED_BYTE, bitm_info.pBit);
free(bitm_info.pHeap);

Ok, i solved the problem:
the reason was that from the second pic on the background Quad was calculated in glPolygonMode(GL_FRONT,GL_LINE);
only because of this the system crashed twice…