New Text Document
New Text Document
h>
void disp();
int main(int argc,char *argv[]){
glutInit(&argc,argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutCreateWindow("VERTEX, PRIMITIVE AND COLOR");//window title
glutDisplayFunc(disp);
glutMainLoop();
return 0;
}
void disp(){
glClearColor(0,0,0,0);//black background
glClear(GL_COLOR_BUFFER_BIT);//clear the color
glColor3f(1.0f,1.0f,1.0f);//green clor
glPointSize(15.0);// the size of pionter
glBegin(GL_QUADS);
glColor3f(0.0f,1.0f,0.0f);
glVertex2f(-0.6,0.3);
glVertex2f(-0.6,-0.15);
glVertex2f(0.6,-0.15);
glVertex2f(0.6,0.3);
glEnd();
glEnd();
glBegin(GL_QUADS);//green
glColor3f(1.0f,1.0f,1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex2f(0.6,0.8);
glVertex2f(0.6,0.7);
glVertex2f(0.8,0.7);
glVertex2f(0.8,0.8);
glEnd();
glBegin(GL_QUADS);//yellow
glColor3f(1.0f,1.0f,0.0f);
glVertex2f(0.6,0.7);
glVertex2f(0.6,0.6);
glVertex2f(0.8,0.6);
glVertex2f(0.8,0.7);
glEnd();
glColor3f(0.0,0.0f,0.0f);
glBegin(GL_LINE_LOOP); //star
glVertex2f(0.65,0.6);
glVertex2f(0.7,0.7);
glVertex2f(0.75,0.6);
glVertex2f(0.625,0.65);
glVertex2f(0.775,0.65);
glVertex2f(0.65,0.6);
glEnd();
glBegin(GL_QUADS);//red
glColor3f(1.0f,0.0f,0.0f);
glVertex2f(0.6,0.6);
glVertex2f(0.6,0.5);
glVertex2f(0.8,0.5);
glVertex2f(0.8,0.6);
glEnd();
glBegin(GL_QUADS);//poll
glColor3f(1.0f,1.0f,1.0f);
glVertex2f(0.55,0.8);
glVertex2f(0.55,0.3);
glVertex2f(0.6,0.3);
glVertex2f(0.6,0.8);
glEnd();
glBegin(GL_QUADS);//rectangle
glColor3f(1.0f,1.0f,0.0f);
glVertex2f(0.0,0.3);
glVertex2f(0.0,0.0);
glVertex2f(0.6,0.0);
glVertex2f(0.6,0.3);
glEnd();
glBegin(GL_QUADS);//upper box
glColor3f(0.0f,1.0f,1.0f);
glVertex2f(0.1,0.5);
glVertex2f(0.0,0.3);
glVertex2f(0.4,0.3);
glVertex2f(0.3,0.5);
glEnd();
glFlush();
}