I have implemented all the commands of a crane, it just lacked its inclination around its axis on top, but I can not reproduce this inclination, as it seems that I have to do translation effects and scale at the same time to adjust, however does not seem to be the best way to do this, look at the generated problem:
Was not to get off the axis understand?
Code I did: link
//Base do guindaste é fixa
glPushMatrix();
glScalef(2.0, 0.5, 1.0);
cubo();
glPopMatrix();
glRotatef( angGiro, 0.0, 1.0, 0.0 );
{
//Base cilindrica de cima da base
// ...
//Base vertical longa ou Haste vertical
// ...
// inclinacao
//Parte cilindrica na ponta de cima da base vertical longa
// ...
glRotatef( angInclinacao, 0, 0, 1 );
{
//Cubo horizontal longo ou Viga
glPushMatrix();
glTranslatef(2-deslViga, 2.75, 0); // deslViga é o deslocamento da viga e diminui metade do que e aumenta/diminui a metade do que o comprimento da viga para poder fazer a relacao de translacao e escala ficarem corretos
glScalef( compViga, 0.3, 0.15);
cubo();
glPopMatrix();
//Parte cilindrica na ponta direita da base horizontal
glPushMatrix();
glTranslatef( compViga, 2.75, -0.0375);
glScalef( 0.2, 0.2, 0.075);
cilindro();
glPopMatrix();
//Parte vertical longa e fina no final da parte cilindrica direita
// ...