From 82d2fc3b7a46dc2d1f69de86cfa61fb572d6471f Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Sat, 28 Apr 2012 17:01:44 +0000 Subject: [PATCH] torus ported. All shapes drawn with glDrawArrays and glDrawElements now. Next is to use the same drawing functions for all shapes, all those with circles still have their own now git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1269 7f0cb862-5218-0410-a997-914c9d46530a --- src/fg_geometry.c | 64 ++++++++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/src/fg_geometry.c b/src/fg_geometry.c index fd79981..7880381 100644 --- a/src/fg_geometry.c +++ b/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