Good, I’m learning to use OpenGL for a project, it is creating a
molecular structure, well my problem is with the rotations to make
the cylinders are coupled to the atoms.
Use a list where I keep the position of each atom and the position of its
parent (which must be connected).
my rotations for each valid pair of vertices (carbon and hydrogen) are as follows:
glPopMatrix ();
glPushMatrix ();
glTranslatef (q-> x, 0, q-> z);
glRotatef (anggama, 0.0,1.0,0.0) / / top-down angle
glRotatef (angteta, 1,0.0,0.0) / / right left
glColor3f (1.0,0.0,0.0);
gluCylinder (quadric, 0.02f, 0.02f, 1.0f, 40, 40);
glPopMatrix ();
for the first carbon (the point [0,0,0]) no problem, paint all
its vertices with a small and q to rotate and then rotate the other becomes a
small error in the angles, but as I modified it last symmetry
angle before rotating.
the problem is with the following carbon, carbon following increases in x and
z (not and) ie instead of just changing the origin of the coordinates, but
when I do the rotation does not come out the appropriate calculations, distorted leaves
and q could make the center of origin is a different location for 0,0,0 for
able to do rotations through