From a01a0426e770b24afba3bc6ec5ab91f6f38cc471 Mon Sep 17 00:00:00 2001 From: dcnieho 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: https://svn.code.sf.net/p/freeglut/code/trunk@1269 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/fg_geometry.c | 64 ++++++++++------------------- 1 file changed, 22 insertions(+), 42 deletions(-) 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