PDA

View Full Version : Help about a code

Srcee
06-05-2011, 02:53 AM
Okay, I'm interested in this code:

float step=2*M_PI/chekor;
float r=0;

glPushMatrix();
glRotatef(90,1,0,0);
glScalef(10,10,10/2/M_PI);
glTranslatef(0,0,-6);
float k=0.5;
while (!(r>=2*M_PI)) {
glBindTexture(GL_TEXTURE_2D, texName3);

glVertex3f(1.0,0,M_PI);
glVertex3f(0,0,3);

glVertex3f(0,0,2.8);
glVertex3f(1.0*cos(step),1.0*sin(step),M_PI);

glTexCoord2f(0.5,k);
glVertex3f(1.2,0,2*M_PI);
glTexCoord2f(1,k);
glVertex3f(1.0,0,M_PI);

glTexCoord2f(1,k+1/9.0);
glVertex3f(1.0*cos(step),1.0*sin(step),M_PI);
glTexCoord2f(0.5,k+1/9.0);
glVertex3f(1.2*cos(step),1.2*sin(step),2*M_PI);

glTexCoord2f(0,k);
glVertex3f(0.85,0,3*M_PI);
glTexCoord2f(0.5,k);
glVertex3f(1.2,0,2*M_PI);

glTexCoord2f(0.5,k+1/9.0);
glVertex3f(1.2*cos(step),1.2*sin(step),2*M_PI);
glTexCoord2f(0,k+1/9.0);
glVertex3f(0.85*cos(step),0.85*sin(step),3*M_PI);

glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
glRotatef(step*360/2/M_PI,0,0,1);
r+=step;k+=1/9.0;
}

glPopMatrix();

How do we get k+1/9.0? In the arguments in glTexCoord2f?

Here's the whole code:
http://www.mediafire.com/?553lizmwkuzu4i2