Контрольная работа: Создание компьютерной графики при помощи OpenGL
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3d(1,1,1);
float pos[4]={3,-3,5,1};
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHTING);
glEnable (GL_LIGHT0);
glEnable (GL_DEPTH_TEST);
quadObj = gluNewQuadric();
float s=0.9-(time0/800);
if (s<0.01 && flag0==1)
{flag0=2;}
if (s>0.9 && flag0==2)
{flag0=1;}
if (flag0==1)
{time0++;}
else
{time0--;}
const float p[4]={0,0,s,0};
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T,GL_OBJECT_PLANE,p);
glRotated(-180,1,0,0);
glTranslated(0,0,-3);
glColor3d(1,1,0);
gluCylinder(quadObj, 1, 1, 3, 50, 50);