0% found this document useful (0 votes)
17 views2 pages

New Text Document

Uploaded by

kenabadane9299
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

New Text Document

Uploaded by

kenabadane9299
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<GL/glut.

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();
}

You might also like