Tuesday 15 May 2012

c++ - Rotating multiple shapes in OpenGL -


After

I am using open and there is a pile of cylinders connected to the area that I want to rotate.

I'm making a kind of 'pipeline' thing and rotation smooth (so that the bottom cylinder rotates, the top one moves accordingly, but without moving the top one down one

Enter image details here

The only issue It is that I want to build on it, but even now with the cylinders, I do not have to take the top one whole thing without turning

My code is:

  zero draw_cylinder (boat translate_x, translate_y floats, angle1 float) {GLUquadricObj * qobj = gluNewQuadric (); Glrotatef (90.0, -45.0, 0.0, 0.0); glu cylinder (cobweb); glrotatef (angle1, 0.0, 0.0, 1.0) Glucradi Coorientation (Cubez, GLUNACIDAD); Glüdisk (qobj, 0.0, 1.0, 20, 20); GlTranslatef (0.0, 0.0, 10.0); Glucadric Orientation (qobj, GLU_OUTSIDE); GluDisc (qobj, 0.0, 1.0, 20, 20); GlPopMatrix (); GlPushMatrix (); // connecting area glTranslatef (translate_x, translate_y + 10.5, 0.0); GlutSolidSphere (1,20,20); GlPopMatrix (); // second cylinder glush matrix (); GlTranslatef (translate_x, translate_y + 11.3, 0.0); Glottef (angle2, 0.0, 0.0, 1.0); GlPushMatrix (); Glottafe (90.0, -45.0, 7.0, -7.0); Glu Cylinder (qobj, 1.0, 1.0, 5.0, 20, 20); Gluquadric Orientation (QBJ, GLUNACIDAD); GluDisc (qobj, 0.0, 1.0, 20, 20); GlTranslatef (0.0, 0.0, 5.0); Gluquadric Orientation (qobj, GLU_OUTSIDE); GluDisc (qobj, 0.0, 1.0, 20, 20); GlPopMatrix (); GlPopMatrix (); GlPopMatrix (); }  

Any help would be appreciated

Asking whether I am estimating the rotation around different points instead of the original, you can check.

In your case:

  • When you rotate your whole hand, use the center point as the reference point below your lower cylinder and your All processes of cylinders (in the reply reply) are applicable.

  • When you want to apply your upper arm, the center of the connection area as the reference point and apply the process to your upper cylinder (int associated connected)


No comments:

Post a Comment