CG Computer Graphics Lab
CG Computer Graphics Lab
CG Computer Graphics Lab
write an opengl program to draw a circle using mid point circle algorithm
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<GL/glut.h>
int ptx=250,pty=250,r=50;
glBegin(GL_POINTS);
glVertex2i(x+ptx, y+pty);
glEnd();
void MPC()
int x=0;
int y=r;
float d=5/4-r;
plot(x,y);
while(y>x)
if(d<0)
x++;
d+=2*x+1;
else
x++;
y--;
d+=2*(x-y)+1;
}
plot(x,y);
plot(x,-y);
plot(-x,y);
plot(-x,-y);
plot(y,x);
plot(-y,x);
plot(y,-x);
plot(-y,-x);
void disp()
glClear(GL_COLOR_BUFFER_BIT);
MPC();
glFlush();
void init()
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS1");
glutDisplayFunc(disp);
init();
glutMainLoop();
return 0;
2. Write an opengl program to draw a rectangle. Use DDA line drawing algorithm to draw the sides.
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<GL/glut.h>
glBegin(GL_POINTS);
double a=(double)p,b=(double)q,c=(double)r,d=(double)s;
double m=(d-b)/(c-a);
double m1=1/m;
if(m<1)
while(a<=c)
{
glVertex2d(a,floor(b));
b=b+m;
a++;
else
while(b<=d)
glVertex2d(floor(a),b);
a=a+m1;
b++;
glEnd();
void init()
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
}
void disp()
glClear(GL_COLOR_BUFFER_BIT);
DDA(100,100,150,160);
glFlush();
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS2");
init();
glutDisplayFunc(disp);
glutMainLoop();
return 0;
3. Write an openg program to draw a polygon and perform rotation and translation.
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<GL/glut.h>
double p1[]={100,100,0};
double p2[]={100,250,0};
double p3[]={250,250,0};
double p4[]={250,100,0};
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-640.0,640.0,-480.0,480.0);
void disp()
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
//glRotatef(30,0,0,1);
glBegin(GL_POLYGON);
glVertex3dv(p1);
glVertex3dv(p2);
glVertex3dv(p3);
glVertex3dv(p4);
glEnd();
glPopMatrix();
glFlush();
glutSwapBuffers();
x=x+a;
y=y+b;
double p=sin((r*3.14)/180);
double q=cos((r*3.14)/180);
double m=(x-a)*q-(y-b)*p;
double n=(x-a)*p+(y-b)*q;
x=m+a;y=n+b;
if(key=='t')
trans(p1[0],p1[1],10,10);
trans(p2[0],p2[1],10,10);
trans(p3[0],p3[1],10,10);
trans(p4[0],p4[1],10,10);
if(key=='o')
p1[0]={100};
p2[0]={100};
p3[0]={250};
p4[0]={250};
p1[1]={100};
p2[1]={250};
p3[1]={250};
p4[1]={100};
}
if(key=='r')
rotate(p1[0],p1[1],p1[0],p1[1],30);
rotate(p1[0],p1[1],p2[0],p2[1],30);
rotate(p1[0],p1[1],p3[0],p3[1],30);
rotate(p1[0],p1[1],p4[0],p4[1],30);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS2");
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glutKeyboardFunc(mykey);
glutDisplayFunc(disp);
glutIdleFunc(disp);
glutReshapeFunc(init);
glutMainLoop();
return 0;
}
4. Write an opengl program to draw a rectangle. Use Bresenham’s line drawing algorithm to draw
the sides.
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<GL/glut.h>
void init()
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
glBegin(GL_POINTS);
int incx,incy,inc1,inc2;
dx=x2-x;
dy=y2-y;
if(dx<0) dx=-dx;
if(dy<0) dy=-dy;
incx=1;
if(x2<x) incx=-1;
incy=1;
if(y2<y) incy=-1;
if(dx>dy)
glVertex2i(x,y);
e=2*dy-dx;
inc1=2*(dy-dx);
inc2=2*dy;
for(i=0;i<dx;i++)
if(e>=0)
y+=incy;
e+=inc1;
else
e+=inc2;
x+=incx;
glVertex2i(x,y);
else
{
glVertex2i(x,y);
e=2*dx-dy;
inc1=2*(dx-dy);
inc2=2*dx;
for(i=0;i<dy;i++)
if(e>=0)
x+=incx;
e+=inc1;
else
e+=inc2;
y+=incy;
glVertex2i(x,y);
glEnd();
void disp()
glClear(GL_COLOR_BUFFER_BIT);
BA(100,100,100,200);
BA(100,200,200,200);
BA(200,200,200,100);
BA(200,100,100,100);
glFlush();
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS2");
init();
glutDisplayFunc(disp);
glutMainLoop();
return 0;
5. Write an opengl program to draw a line using dda algorithm and perform translation operation
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<GL/glut.h>
int a=100;
int b=110;
int c=250;
int d=280;
glBegin(GL_POINTS);
double a=(double)p,b=(double)q,c=(double)r,d=(double)s;
double m=(d-b)/(c-a);
double m1=1/m;
if(m<1)
while(a<=c)
glVertex2d(a,floor(b));
b=b+m;
a++;
else
while(b<=d)
glVertex2d(floor(a),b);
a=a+m1;
b++;
glEnd();
}
void init()
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
void disp()
glClear(GL_COLOR_BUFFER_BIT);
DDA(a,b,c,d);
glFlush();
x=x+a;
y=y+b;
if(key=='t')
trans(a,b,10,10);
trans(c,d,10,10);
}
}
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS2");
init();
glutKeyboardFunc(mykey);
glutDisplayFunc(disp);
glutIdleFunc(disp);
glutMainLoop();
return 0;
6. Write an opengl program to draw the given figure at the center of the drawing window.
#include <stdio.h>
#include <iostream>
#include <GL/glut.h>
int w=640,h=480;
int x1=w/2;
int y1=h/2;
int r=30;
glBegin(GL_POINTS);
glVertex2i(x+x1, y+y1);
glEnd();
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
void midPointCircleAlgo(int r)
int x = 0;
int y = r;
plot(x, y,x1,y1);
while (y > x)
if (decision < 0)
x++;
decision += 2*x+1;
else
{
y--;
x++;
decision += 2*(x-y)+1;
plot(x, y,x1,y1);
plot(x, -y,x1,y1);
plot(-x, y,x1,y1);
plot(-x, -y,x1,y1);
plot(y, x,x1,y1);
plot(-y, x,x1,y1);
plot(y, -x,x1,y1);
plot(-y, -x,x1,y1);
void myDisplay(void)
glClear (GL_COLOR_BUFFER_BIT);
glPointSize(1.0);
midPointCircleAlgo(r);
glBegin(GL_LINES);
glVertex2i(x1-r,y1-r);
glVertex2i(x1-r,y1+r);
glVertex2i(x1-r,y1+r);
glVertex2i(x1+r,y1+r);
glVertex2i(x1+r,y1+r);
glVertex2i(x1+r,y1-r);
glVertex2i(x1+r,y1-r);
glVertex2i(x1-r,y1-r);
glEnd();
glFlush ();
}
glutInit(&argc, argv);
glutDisplayFunc(myDisplay);
myInit ();
glutMainLoop();
return 0;
7. Write an opengl programs to draw a polygon and fill the polygon by a color flood fill
Algorithm.
#include <math.h>
#include <GL/glut.h>
#include<stdio.h>
#include<iostream>
struct Point{
int x;
int y;
};
struct Color{
float r;
float g;
float b;
};
Color color;
glReadPixels(x,y,1,1,GL_RGB,GL_FLOAT,&color);
return color;
glColor3f(color.r,color.g,color.b);
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
glFlush();
Color color;
color=getPixelColor(x,y);
if(color.r==oldcolor.r&&color.g==oldcolor.g&&color.b==oldcolor.b)
setPixelColor(x,y,newcolor);
FloodF(x+1,y,oldcolor,newcolor);
FloodF(x,y+1,oldcolor,newcolor);
FloodF(x-1,y,oldcolor,newcolor);
FloodF(x,y-1,oldcolor,newcolor);
return;
if(key=='f')
Color newcolor={1.0f,0.0f,0.0f};
Color oldcolor={1.0f,1.0f,1.0f};
FloodF(150,150,oldcolor,newcolor);
glBegin(GL_POINTS);
double a=(double)p;
double b=(double)q;
double c=(double)r;
double d=(double)s;
double m=(d-b)/(c-a);
double m1=1/m;
if(m<1)
while(a<=c)
glVertex2d(a,round(b));
b=b+m;
a++;
}
else
while(b<=d)
glVertex2d(round(a),b);
a=a+m1;
b++;
glEnd();
void drawrect(){
DDA(100,100,100,200);
DDA(100,200,200,200);
DDA(200,100,200,200);
DDA(100,100,200,100);
void init() {
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 300, 0, 300);
void disp()
glClear(GL_COLOR_BUFFER_BIT);
drawrect();
glFlush();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(300, 300);
glutInitWindowPosition(200, 200);
glutCreateWindow("Open GL");
init();
glutDisplayFunc(disp);
glutKeyboardFunc(mykey);
glutIdleFunc(disp);
glutMainLoop();
return 0;
#include <math.h>
#include <GL/glut.h>
#include<stdio.h>
#include<iostream>
struct Point{
int x;
int y;
};
struct Color{
float r;
float g;
float b;
};
Color color;
glReadPixels(x,y,1,1,GL_RGB,GL_FLOAT,&color);
return color;
glColor3f(color.r,color.g,color.b);
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
glFlush();
}
setPixelColor(x, y, fillColor);
return;
if(key=='f')
BoundaryF(150,150,fillColor,boundaryColor);
glBegin(GL_POINTS);
double a=(double)p;
double b=(double)q;
double c=(double)r;
double d=(double)s;
double m=(d-b)/(c-a);
double m1=1/m;
if(m<1)
while(a<=c)
glVertex2d(a,round(b));
b=b+m;
a++;
else
while(b<=d)
glVertex2d(round(a),b);
a=a+m1;
b++;
glEnd();
void drawrect(){
DDA(100,100,100,200);
DDA(100,200,200,200);
DDA(200,100,200,200);
DDA(100,100,200,100);
}
void init() {
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
void disp()
glClear(GL_COLOR_BUFFER_BIT);
drawrect();
glFlush();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(300, 300);
glutInitWindowPosition(200, 200);
glutCreateWindow("Open GL");
init();
glutDisplayFunc(disp);
glutKeyboardFunc(mykey);
glutIdleFunc(disp);
glutMainLoop();
return 0;}
#include<stdio.h>
#include<iostream>
#include<GL/glut.h>
double u1=0,u2=1;
double x1=30,x2=30,y3=-80,y2=15;
double xmin=-50,ymin=-50,xmax=50,ymax=50;
double p[4],q[4];
void init()
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-300.0,300.0,-300.0,300.0);
double dx=x2-x1,dy=y2-y1;
int i;
double t;
p[0]=-dx;q[0]=x1-xmin;
p[1]=dx;q[1]=xmax-x1;
p[2]=-dy;q[2]=y1-ymin;
p[3]=dy;q[3]=ymax-y1;
for(i=0;i<4;i++)
if(p[i]==0&&q[i]<0)
return;
if(p[i]<0)
t=(q[i])/(p[i]);
if(t>u1&&t<u2)
u1=t;
cout<<"u1::"<<u1<<endl;
else if(p[i]>0)
t=(q[i])/(p[i]);
if(t>u1&&t<u2)
u2=t;
cout<<"u2::"<<u2<<endl;
cout<<"u1::"<<u1<<endl;
cout<<"u2::"<<u2<<endl;
if(u1<u2)
x1=x1+u1*(x2-x1);
y1=y1+u1*(y2-y1);
x2=x1+u2*(x2-x1);
y2=y1+u2*(y2-y1);
cout<<x1<<endl<<x2<<endl<<y1<<endl<<y2<<endl;
glBegin(GL_LINES);
glVertex2d(x1,y1);
glVertex2d(x2,y2);
glEnd();
glFlush();
void disp()
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2d(xmin,ymin);
glVertex2d(xmin,ymax);
glVertex2d(xmin,ymax);
glVertex2d(xmax,ymax);
glVertex2d(xmax,ymax);
glVertex2d(xmax,ymin);
glVertex2d(xmax,ymin);
glVertex2d(xmin,ymin);
glEnd();
glBegin(GL_LINES);
glVertex2d(x1,y3);
glVertex2d(x2,y2);
glEnd();
glFlush();
glClear(GL_COLOR_BUFFER_BIT);
if(key=='c')
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2d(xmin,ymin);
glVertex2d(xmin,ymax);
glVertex2d(xmin,ymax);
glVertex2d(xmax,ymax);
glVertex2d(xmax,ymax);
glVertex2d(xmax,ymin);
glVertex2d(xmax,ymin);
glVertex2d(xmin,ymin);
glEnd();
clip(x1,y3,x2,y2);
glFlush();
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(300,300);
glutInitWindowPosition(100,100);
glutCreateWindow("LB");
init();
glutKeyboardFunc(mykey);
glutDisplayFunc(disp);
glutMainLoop();
return 0;
10. Write an program to create (without using built in function) a square and implement shear
algorithm along x axis and y axis.
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<GL/glut.h>
double p1[]={100,100,0};
double p2[]={100,250,0};
double p3[]={250,250,0};
double p4[]={250,100,0};
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,640.0,0,480.0);
}
void disp()
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex3dv(p1);
glVertex3dv(p2);
glVertex3dv(p3);
glVertex3dv(p4);
glEnd();
glFlush();
glutSwapBuffers();
x=x+s*y;
y=y+s*x;
if(key=='x')
shearx(p2[0],p2[1],1.2);
shearx(p3[0],p3[1],1.2);
}
if(key=='y')
sheary(p1[0],p1[1],1.2);
sheary(p2[0],p2[1],1.2);
if(key=='o')
p1[0]={100};
p2[0]={100};
p3[0]={250};
p4[0]={250};
p1[1]={100};
p2[1]={250};
p3[1]={250};
p4[1]={100};
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("AS2");
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.2,0.2,0.2);
glPointSize(2.0);
glutKeyboardFunc(mykey);
glutDisplayFunc(disp);
glutIdleFunc(disp);
glutReshapeFunc(init);
glutMainLoop();
return 0;
11. Wap in C/C++ using Opengl to implement Cohen Sutherland line clipping algorithm
#include<GL/glut.h>
#include<math.h>
#include<stdio.h>
#include<iostream>
void display();
float xmin=-100;
float ymin=-100;
float xmax=100;
float ymax=100;
float xd1,yd1,xd2,yd2;
void init(void)
glClearColor(0.0,0,0,0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(-300,300,-300,300);
}
int c=0;
if(y>ymax)c=8;
if(y<ymin)c=4;
if(x>xmax)c=c|2;
if(x<xmin)c=c|1;
return c;
int c1=code(x1,y1);
int c2=code(x2,y2);
float m=(y2-y1)/(x2-x1);
while((c1|c2)>0)
exit(0);
int c=c1;
if(c==0)
c=c2;
xi=x2;
yi=y2;
float x,y;
if((c & 8)>0)
y=ymax;
x=xi+ 1.0/m*(ymax-yi);
else
y=ymin;
x=xi+1.0/m*(ymin-yi);
else
x=xmax;
y=yi+m*(xmax-xi);
else
x=xmin;
y=yi+m*(xmin-xi);
if(c==c1)
xd1=x;
yd1=y;
c1=code(xd1,yd1);
if(c==c2)
xd2=x;
yd2=y;
c2=code(xd2,yd2);
display();
if(key=='c'||key=='a')
{ cout<<"Clipped"<<endl;
cohen_Line(xd1,yd1,xd2,yd2);
glFlush();
void display()
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,1.0,0.0);
glBegin(GL_LINE_LOOP);
glVertex2i(xmin,ymin);
glVertex2i(xmin,ymax);
glVertex2i(xmax,ymax);
glVertex2i(xmax,ymin);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_LINES);
glVertex2i(xd1,yd1);
glVertex2i(xd2,yd2);
glEnd();
glFlush();
cin>>xd1>>yd1>>xd2>>yd2;
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(600,600);
glutInitWindowPosition(0,0);
glutCreateWindow("Clipping");
glutDisplayFunc(display);
glutKeyboardFunc(mykey);
init();
glutMainLoop();
return 0;
12. Wap using Opengl to perform a 3-Dimensional transformation such as translation, rotation and
reflection on a given triangle.
#include<stdio.h>
#include<iostream>
#include<GL/glut.h>
float a1=100.0,b1=100.0,c1=0.0,a2=150.0,b2=200.0,c2=0.0,a3=200.0,b3=100.0,c3=0.0;
float rr,rx,ry,rz,tx,ty,tz,sx,sy,sz;
y=-y;
x=-x;
y=-y;
void rotate()
void init()
glClearColor(1,1,1,0);
glColor3f(0.2,0.2,0.2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-600,600,-600,600,-600,600);
-
void disp()
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex2i(-600,0);
glVertex2i(600,0);
glVertex2i(0,-600);
glVertex2i(0,600);
glEnd();
glPushMatrix();
glTranslatef(tx,ty,tz);
glRotatef(rr,rx,ry,rz);
glScalef(sx,sy,sz);
glBegin(GL_TRIANGLES);
glVertex3f(a1,b1,c1);
glVertex3f(a2,b2,c2);
glVertex3f(a3,b3,c3);
glEnd();
glPopMatrix();
glFlush();
glutSwapBuffers();
if(key=='r')
rz=1;
rr=30;
if(key=='t')
{
tx=100;
ty=100;
if(key=='s')
sx=sy=sz=1.5;
if(key=='z')
refectz(a1,b1,c1);
refectz(a2,b2,c2);
refectz(a3,b3,c3);
if(key=='x')
refectx(a1,b1,c1);
refectx(a2,b2,c2);
refectx(a3,b3,c3);
if(key=='y')
refecty(a1,b1,c1);
refecty(a2,b2,c2);
refecty(a3,b3,c3);
if(key=='o')
rr=0.0;rx=0;ry=0;rz=0.0;
tx=ty=tz=0.0;
sz=sx=sy=1.0;
}
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(600,600);
glutInitWindowPosition(100,100);
glutCreateWindow("AS12");
rr=0.0;rx=0;ry=0;rz=0.0;
tx=ty=tz=0.0;
sz=sx=sy=1.0;
init();
glutKeyboardFunc(mykey);
glutDisplayFunc(disp);
glutIdleFunc(disp);
glutMainLoop();
return 0;
13. Show that two successive reflection about either of the coordinate axes is equivalent to a single
rotation about the coordinate origin. Run your program for an object in the first quadrant.
#include <stdio.h>
#include <iostream>
#include <GL/glut.h>
using namespace std;
int w=640,h=480;
GLint x1,x2,y1,y2;
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(key=='x')
y1=-y1;
y2=-y2;
if(key=='y')
x1=-x1;
x2=-x2;
if(key=='o')
x1=-x1;
x2=-x2;
y2=-y2;
y1=-y1;
void myDisplay(void)
glClear (GL_COLOR_BUFFER_BIT);
glPointSize(1.0);
glBegin(GL_LINES);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glEnd();
glBegin(GL_LINES);
glVertex2i(-640,0);
glVertex2i(640,0);
glEnd();
glEnd();
glBegin(GL_LINES);
glVertex2i(0,480);
glVertex2i(0,-480);
glEnd();
glFlush ();
glutInit(&argc, argv);
x1=150;x2=300;y1=200;y2=300;
glutKeyboardFunc(mykey);
glutDisplayFunc(myDisplay);
glutIdleFunc(myDisplay);
myInit ();
glutMainLoop();
return 0;