From 4bb957b58beb8c268b37549e8d6d4fa4b925f858 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster 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: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1150 7f0cb862-5218-0410-a997-914c9d46530a --- src/fg_geometry.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/fg_geometry.c b/src/fg_geometry.c index 743909d..66659a4 100644 --- a/src/fg_geometry.c +++ b/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