/* Module : SierpMainFile.cpp * Author : Robert W. Lindeman * Email : gogo@wpi.edu * Course : CS-543 * * Description : Most of this code is from Emmanuel Agu, adapted from * Sandy Hill, UMass-Amherst. * * Draws a Sierpinski Gasket. * * Date : 2005/10/20 * * History: * Revision Date Changed By * -------- ---------- ---------- * 01.00 2005/10/20 gogo * First release. * * (c) Copyright 2005, Worcester Polytechnic Institute. */ /* -- INCLUDE FILES ------------------------------------------------------ */ #include #include #include /* -- DATA STRUCTURES ---------------------------------------------------- */ // Our point class. class GLintPoint { }; /* -- GLOBAL VARIABLES --------------------------------------------------- */ /* -- LOCAL VARIABLES ---------------------------------------------------- */ /* ----------------------------------------------------------------------- */ /* Function : int random( int m ) * * Description : Return a random integer between 0 and ( m-1 ). * * Parameters : int m : The random number will be between 0 and ( m-1 ). * * Returns : int : Random number between 0 and ( m-1 ). */ int random( int m ) { } /* ----------------------------------------------------------------------- */ /* Function : void drawDot( GLint x, GLint y ) * * Description : Draw a point at location (x, y) in the window. * * Parameters : GLint x : X coordinate of point to draw. * GLint y : X coordinate of point to draw. * * Returns : void */ void drawDot( GLint x, GLint y ) { } /* ----------------------------------------------------------------------- */ /* Function : void myInit( void ) * * Description : Initialize OpenGL and the window where things will be * drawn. * * Parameters : void * * Returns : void */ void myInit( void ) { glClearColor( 1.0, 1.0, 1.0, 0.0 ); glColor3f( 0.0, 0.0, 0.0 ); glPointSize( 1.0 ); glMatrixMode( GL_PROJECTION ); glLoadIdentity( ); gluOrtho2D( 0.0, 640.0, 0.0, 480.0 ); } /* ----------------------------------------------------------------------- */ /* Function : void Sierpinski( void ) * * Description : Draw a Sierpinski gasket. * * Parameters : void * * Returns : void */ void Sierpinski( void ) { } /* ----------------------------------------------------------------------- */ /* Function : void myDisplay( void ) * * Description : This function gets called everytime the window needs to * be redrawn. * * Parameters : void * * Returns : void */ void myDisplay( void ) { glClear( GL_COLOR_BUFFER_BIT ); Sierpinski( ); } /* ----------------------------------------------------------------------- */ /* Function : int main( int argc, char** argv ) * * Description : This is the main function. It sets up the rendering * context, and then reacts to user events. * * Parameters : int argc : Number of command-line arguments. * char *argv[] : Array of command-line arguments. * * Returns : int : Return code to pass to the shell. */ int main( int argc, char *argv[] ) { // Initialize GLUT. glutInit( &argc, argv ); // Set the mode to draw in. glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); // Set the window size in screen pixels. glutInitWindowSize( 640, 480 ); // Set the window position in screen pixels. glutInitWindowPosition( 100, 150 ); // Create the window. glutCreateWindow( "Sierpinski Gasket" ); // Set the callback funcion to call when we need to draw something. glutDisplayFunc( myDisplay ); // Initialize some things. myInit( ); // Now that we have set everything up, loop responding to events. glutMainLoop( ); } /* ----------------------------------------------------------------------- */