From 92b1d69dd4619ba13dfd6bd9cf5bd34bf49c4344 Mon Sep 17 00:00:00 2001 From: dcnieho Date: Fri, 16 Mar 2012 05:06:31 +0000 Subject: [PATCH] dSize parameter of Cube now works correctly again Fixed some inconsistent Macro naming and variable types git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1150 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/fg_geometry.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/freeglut/freeglut/src/fg_geometry.c b/freeglut/freeglut/src/fg_geometry.c index 743909d..66659a4 100644 --- a/freeglut/freeglut/src/fg_geometry.c +++ b/freeglut/freeglut/src/fg_geometry.c @@ -138,8 +138,8 @@ static unsigned int ipow (int x, unsigned int y) #define CUBE_NUM_VERT 8 #define CUBE_NUM_FACES 6 #define CUBE_NUM_VERT_PER_FACE 4 -#define CUBE_VERT_PER_TETR CUBE_NUM_FACES*CUBE_NUM_VERT_PER_FACE -#define CUBE_VERT_ELEM_PER_TETR CUBE_VERT_PER_TETR*3 +#define CUBE_VERT_PER_CUBE CUBE_NUM_FACES*CUBE_NUM_VERT_PER_FACE +#define CUBE_VERT_ELEM_PER_CUBE CUBE_VERT_PER_CUBE*3 /* Vertex Coordinates */ static GLdouble cube_v[CUBE_NUM_VERT*3] = { @@ -176,8 +176,8 @@ static GLubyte cube_vi[CUBE_NUM_FACES*CUBE_NUM_VERT_PER_FACE] = /* Cache of input to glDrawArrays */ static GLboolean cubeCached = FALSE; -static double cube_verts[CUBE_VERT_ELEM_PER_TETR]; -static double cube_norms[CUBE_VERT_ELEM_PER_TETR]; +static double cube_verts[CUBE_VERT_ELEM_PER_CUBE]; +static double cube_norms[CUBE_VERT_ELEM_PER_CUBE]; static void fghCubeGenerate() { @@ -343,11 +343,17 @@ static void fghCube( GLdouble dSize, GLboolean useWireMode ) if (dSize!=1.) { - /* Need to build new */ - fghDrawGeometry(GL_QUADS,cube_verts,cube_norms,CUBE_VERT_PER_TETR,useWireMode); + int i; + + /* Need to build new vertex list containing vertices for cube of different size */ + GLdouble *vertices = malloc(CUBE_VERT_ELEM_PER_CUBE * sizeof(double)); + for (i=0; i