PDA

View Full Version : Opengl code understanding problem



Niloy roy
09-23-2016, 02:20 PM
I want to know the step by step outputs of the functions called in the following code segment . This code segment is taken from an opengl project to show the animation of tower of hanoi. The function i am asking about is used for drawing a pin , on which the disks (of tower of hanoi problem) are ordered. I just want to know how the functions are gradually drawing a pin ??
here is the code :

void drawPin(GLUquadricObj **quadric, const GLfloat radius, const GLfloat height)
{
glPushMatrix();
glRotatef(-90.0, 1.0, 0.0, 0.0);
gluCylinder(*quadric, radius, radius, BREITE/2, SLICES, LOOPS);
gluQuadricOrientation(*quadric, GLU_INSIDE);
gluDisk(*quadric, 0.0, radius, SLICES, LOOPS);
gluQuadricOrientation(*quadric, GLU_OUTSIDE);
glTranslatef(0.0, 0.0, BREITE/2);
gluDisk(*quadric, 0.0, radius, SLICES, LOOPS);
gluCylinder(*quadric, STANGENBREITE, STANGENBREITE, height, INNERSLICES, LOOPS);
glTranslatef(0.0, 0.0, height);
gluDisk(*quadric, 0.0, STANGENBREITE, INNERSLICES, LOOPS);
glPopMatrix();
}