X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffg_geometry.c;h=66659a46f1b7725f46de1a6bb871a7043e735d34;hb=4bb957b58beb8c268b37549e8d6d4fa4b925f858;hp=743909d63d0aa059c0cab0691695e4d6a9f7ea5b;hpb=5de2f0e3013d4906bf05343dee518929ef979bcc;p=freeglut 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