diff --git a/freeglut/freeglut/src/fg_geometry.c b/freeglut/freeglut/src/fg_geometry.c index fd79981..7880381 100644 --- a/freeglut/freeglut/src/fg_geometry.c +++ b/freeglut/freeglut/src/fg_geometry.c @@ -1757,22 +1757,39 @@ static void fghTorus( double dInnerRadius, double dOuterRadius, GLint nSides, GL GLushort *stripIdx; /* Allocate buffers for indices, bail out if memory allocation fails */ - //stripIdx = malloc((slices+1)*2*(stacks+2)*sizeof(GLushort)); + stripIdx = malloc((nRings+1)*2*nSides*sizeof(GLushort)); if (!(stripIdx)) { free(stripIdx); fgError("Failed to allocate memory in fghTorus"); } + for( i=0, idx=0; i