Hi guys 


first of all this my first opengl project in ubuntu, i used xcode befoer and every thing went fine.

in this project i almost the same code that i used in xcode but i'm facing a problem where that  the only shape will show is the last shape is coded. 

so i don't know if this is a problem in coding in opengl or the problem in libs .
here is the code and till me what you think 


#include  
#include
#include

void display(){

{
glClear(GL_COLOR_BUFFER_BIT);

glColor3f(1.0,0.0,0.0);
glBegin(GL_TRIANGLES);
glVertex2f(0.0,0.60);
glVertex2f(0.0,0.40);
glVertex2f(0.40,0.40);

glEnd();}

{
glColor3f(1.0,0.0,0.0);
glBegin(GL_TRIANGLES);
glVertex2f(0.0,0.60);
glVertex2f(0.0,0.40);
glVertex2f(0.40,0.40);

glEnd();}



glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.80,1.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(-0.60,0.0);
glVertex2f(0.60,0.0);
glVertex2f(0.60,-1.0);
glVertex2f(-0.60,-1.0);

glEnd();}



{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.50,0.0,1.0);
glBegin(GL_LINE_STRIP);
glVertex2f(0.50,0.50);
glVertex2f(0.70,-0.30);
//glVertex2f(-0.30,0.30);
glEnd();}


glFlush();

}


int main (int argc,char** argv){

glutInit(&argc, argv);
glutCreateWindow("HEYY!");
glClearColor(1.0,1.0,1.0,0.0);
glutDisplayFunc(display);

glutMainLoop();
return 0;
}