/* File: oglexSphere.c Notes: basically a copy of the CAVE OpenGL example ball.c */ #include "stdio.h" #include #include void oglexInit(void); void oglexDraw(void); main(int argc, char **argv) { /* Initialize the CAVE */ CAVEConfigure(&argc,argv,NULL); CAVEInit(); /* Give the library a pointer to the GL initialization function */ CAVEInitApplication(oglexInit, NULL); /* Give the library a pointer to the drawing function */ CAVEDisplay(oglexDraw, NULL); /* Wait for the escape key to be hit */ while (!CAVEgetbutton(CAVE_ESCKEY)) sginap(10); /* Clean up & exit */ CAVEExit(); } static GLUquadricObj *sphereObj; void oglexInit(void) { glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); sphereObj = gluNewQuadric(); } void oglexDraw(void) { float cyan[4] = { 0.0, 1.0, 1.0, 1.0 }; glClearColor(0., 0., 0., 0.); glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); glPushMatrix(); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, cyan); glTranslatef(0.0, 5.0, -4.0); gluSphere(sphereObj, 1.0, 15, 15); glPopMatrix(); }