View Full Version : Snake 3D - Problems with the redesign of the body

11-25-2014, 01:47 PM
Hi guys,
I'm new with the programming in openGl.
My problem is with the redesign of the body of the snake.
The body is displayed in this way.
For heach movement of the head I write the new position in head of a list. The redesign is handled in a loop which slide the list from the beginning to the end (ie from the head to the end of the tail). The body is composed with multiple cylinders, drawn with the function gluCylinder(), and for the corners, quarters of torus, which are translated and rotated in an appropriate way.
In the loop I check some cases:
-if the snake is moving straight on the Z axis(is drawn a simple cylinder)
-if the snake is movign straight on the X axis (is drawn a simple cylinder rotate by 90)
-if the snake is curving(is drawn a quarter of a torus for each case of new direction)

The problem with the redesign is that after drawing the corner the cylinder form the corner to the end of the tail disappear and I don't know why?
Someone could help me?

Thank you in advance