open GL glitch

hi

For some awkward reason my projects displays my object once (found out during debugging) on screen and then displays the clear screen colour constantly.

It specifically happens after the gluSwapBufffers(); call. However weirdly, it wasn’t doing this before so I’m just left wondering if this has happened to you guys.

Anyway below is an extract of my project, but I’m not sure what causes such an error.

Draw()
{
	switch (gbShow)
	{
	case 1:	
	
	glPopMatrix();
	glTranslatef(f_X,f_Y,0.0f);
	glPushMatrix();
	//visible
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, gui_TextureID);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glNormal3f(0.0f,0.0f,1.0f);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glBegin(GL_QUADS);
	glColor4f(1.0,1.0,1.0,0.9);

    glTexCoord2f(gfCoord_1X, gfCoord_1Y);glVertex3f(gfVertex1_X, gfVertex1_Y, 0.0f);
    glTexCoord2f(gfCoord_2X, gfCoord_2Y);glVertex3f(gfVertex2_X, gfVertex2_Y, 0.0f);
    glTexCoord2f(gfCoord_3X, gfCoord_3Y);glVertex3f(gfVertex3_X, gfVertex3_Y, 0.0f);
    glTexCoord2f(gfCoord_4X, gfCoord_4Y);glVertex3f(gfVertex4_X, gfVertex4_Y, 0.0f);
    glEnd();
    glFlush();
	break;
	default:
		std::cout<<"object hidden"<<std::endl;
		break;
	}
}
void display(void)
{	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(1.0,0.0,0.0,1.0);
	
	//STATE: MENU
	C_Visual_Obj qMenu((GLboolean) 1,
		                guiSmile_txtID,
						(GLboolean)0,
						1.0f,
						300.0f,
						100.0f,
						0.0f, 0.0f,//V1
						100.0f,0.0f,//V2
						100.0f,50.f,//V3
						0.0f,50.f,//V4
						Anime_Static);
	qMenu.Draw();
	
	//SATE: GAME

	//STATE: RESET
	
	
   glutSwapBuffers();
}

This looks not good :


   glPopMatrix();
   glTranslatef(f_X,f_Y,0.0f);
   glPushMatrix();
   // draw commands

It should probably be like :


   glPushMatrix(); // save current Xform
   glTranslatef(f_X,f_Y,0.0f); // apply translation
   // draw commands // draw the translated stuff
   glPopMatrix(); // restore Xform (ie. cancel translation here)

You are amazing man