PDA

View Full Version : Okease help me with move crane cranes ?



ljubomir993
12-17-2014, 09:30 AM
How do I move the inner and outer crane cranes?


1557

This is code from cranes:


// Outer crane
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_CRAN]);
glColor3ub(255, 255, 255);
glPushMatrix();

// TODO 2: Nacrtati spoljni kran kao kvadar sirine 3.2, visine 0.5 i dubine 0.4 na poziciji (1.6, 0.2, -0.2)

glTranslatef(g_TranslateX+0.4,0.8,-0.55);
glRotatef(g_RotateZ+2.5,0.0f,0.0f,1.0f);
glScalef(3.2f, 0.5f, 0.4f);
glutSolidCube(1.0);
glPopMatrix();


// inner crane (extensor)
glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_METAL]);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glColor3ub(255, 255, 255);
glPushMatrix();

// TODO 2: Nacrtati unutrasnji kran kao kvadar sirine 3.2, visine 0.35 i dubine 0.28 na poziciji (3.2, 0.2, -0.2)

glNormal3f(1.0, 1.0, 1.0);
glTranslatef(g_TranslateX+2.0, 0.85, -0.53);

glScaled(3.2, 0.35, 0.28);
glutSolidCube(1);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glPopMatrix();