int test_cube() { unit_cube(0, true); unit_cube(1, true); unit_cube(407, true); unit_cube(153, true); return 0; }
ENTRYPOINT void init_ball (ModeInfo *mi) { int wire = MI_IS_WIREFRAME(mi); blinkboxstruct *bp; if(blinkbox == NULL) { if((blinkbox = (blinkboxstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (blinkboxstruct))) == NULL) return; } bp = &blinkbox[MI_SCREEN(mi)]; if ((bp->glx_context = init_GL(mi)) != NULL) { reshape_ball(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); glDrawBuffer(GL_BACK); } else MI_CLEARWINDOW(mi); bp->ball.d = 1; bp->bscale.wh = bscale_wh; bp->bscale.d = 0.25; bp->mo.x = 1; bp->mo.y = 1; bp->mo.z = 1; bp->moh.x = -1.0; bp->moh.y = -1.5; bp->moh.z = -1.5; bp->bpos.x = 1; bp->bpos.y = 1; bp->bpos.z = 1; bp->des_amt = 1; bp->lside.counter = MAX_COUNT; bp->rside.counter = MAX_COUNT; bp->tside.counter = MAX_COUNT; bp->bside.counter = MAX_COUNT; bp->fside.counter = MAX_COUNT; bp->aside.counter = MAX_COUNT; bp->lside.color[0] = 1; bp->rside.color[1] = 1; bp->tside.color[2] = 1; bp->bside.color[0] = 1; bp->bside.color[1] = 0.5; bp->fside.color[0] = 1; bp->fside.color[1] = 1; bp->aside.color[0] = 0.5; bp->aside.color[2] = 1; bp->lside.rot[0] = 90; bp->rside.rot[0] = 90; bp->tside.rot[0] = 90; bp->bside.rot[0] = 90; bp->fside.rot[0] = 90; bp->aside.rot[0] = 90; bp->lside.rot[2] = 1; bp->rside.rot[2] = 1; bp->tside.rot[1] = 1; bp->bside.rot[1] = 1; bp->fside.rot[3] = 1; bp->aside.rot[3] = 1; bp->lside.des_count = 1; bp->rside.des_count = 1; bp->tside.des_count = 1; bp->bside.des_count = 1; bp->fside.des_count = 1; bp->aside.des_count = 1; bp->lside.alpha_count = 1; bp->rside.alpha_count = 1; bp->tside.alpha_count = 1; bp->bside.alpha_count = 1; bp->fside.alpha_count = 1; bp->aside.alpha_count = 1; #define SPHERE_SLICES 12 /* how densely to render spheres */ #define SPHERE_STACKS 16 bp->sp = malloc(sizeof(*bp->sp)); if(bp->sp == NULL){ fprintf(stderr,"Could not allocate memory\n"); exit(1); } if( (bp->bscale.wh < 1) || (bp->bscale.wh > 8) ) { fprintf(stderr,"Boxsize out of range. Using default\n"); bp->bscale.wh = 2; } if (do_dissolve){ bp->des_amt = bp->bscale.wh / MAX_COUNT; } reshape_ball(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); bp->ballList = glGenLists(1); glNewList(bp->ballList, GL_COMPILE); unit_sphere (SPHERE_STACKS, SPHERE_SLICES, wire); glEndList (); bp->boxList = glGenLists(1); glNewList(bp->boxList, GL_COMPILE); unit_cube(wire); glEndList(); if (wire) return; glEnable(GL_COLOR_MATERIAL); glShadeModel(GL_SMOOTH); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_LIGHTING); glClearDepth(1); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); glEnable(GL_LIGHT1); if (do_fade || do_blur) { glEnable(GL_BLEND); glDisable(GL_DEPTH_TEST); } }