# include "sgl.h" /********************************************************* * sgl sample 2 * ********************************************************/ // SGL Graphics Manager // ------------------- static sgl g; static GLint gear1, gear2, gear3, gear4; /******************************************************* * p a i n t * * handle paint calls * - set matrix correclty * - display objects *******************************************************/ static void paint(void) { g.paint(); } /******************************************************* * i n i t * * initialize scene: * environment variables * object creation/definition *******************************************************/ static void init(void) { static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0}; glLightfv(GL_LIGHT0, GL_POSITION, pos); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glEnable(GL_NORMALIZE); } /******************************************************* * m a i n *******************************************************/ int main(int argc, char *argv[]) { SolidBox b(1.3,2,1, 0,0,8); b.setRGBColor(10,180,125); b.setRotation(45,0,45); Link l1(b,POINT_TO_POINT); l1.settime(g.time); l1.setTimeInterval(200,2000); // - degrees of movement per time unit // or // frequency, how may revolutions // in a 360 time units cycle // - displacement, start at // - amplitud (change*amp) l1.setIterMode(SINE,.1,90,1); // since i want to traverse 180 degrees in 1800 // time units, then .1 dgree per time unit l1.setChange(.5,-2.5,-30); g.add(l1); g.init(argc, argv, 100, 100, 250, 500); g.optimizePaint(); init(); glutDisplayFunc(paint); /* paint handler */ glutMainLoop(); return 0; }