Lab Work - Getting Started / SimpleDraw demo

Goals: Learn how to copy programs from the course homepage to your computer, how to compile and run programs with Microsoft Visual C++, how to edit source files.

Copying from the course homepage.  After logging in, download the file, which is available via the course home page,   (Go there via the link to sample OpenGL programs supplied with the course textbook.)  After downloading, place all the files in a new directory, for instance, create a direction H:\SimpleDraw and place the files there. (Visual C++ requires you to put each programming projectin its own directory!).  
    Try running the executable program (the .exe filename extension may not show up in the file list, but look for the executable icon).  Hit the space bar to toggle between the five different displays.  The dots and lines are drawn rather thin and may be hard to see, so you may need to look closely, especially to see the dots in the first display. .   Now erase the exectuable.  You'll recreate it in the next step.
    If you are not using Visual C++:  download just the source and header files, and compile them as needed with your compiler.  Make sure the OpenGL header files and libraries are in the right place, including the GLUT routines.

    Congratulations!  You have now successfully downloaded and run an OpenGL program.

Compiling and running SimpleDraw.exe.  (with Visual C++)   Double-click on the file with extension "dsw" (= "Development Studio Workspace").  This starts the compiler. 
     To compile and link the program, pick the Build Solar.exe option from the Build menu.  (Note that the Compile option will compile, but not link the program.)  The build can also be invoked by a icon on the second menu bar, or by just pressing the F7 command key.
    Hopefully, your compile and link worked without any error messages.   If there were error messages, you will need to fix something.  (Let Frank or I know if you have any problems at this point, so we can alert other students.)
    Once the file Solar.exe is built, you can run it by selecting Execute (or Go) from the Build menu.  Alternately you can use the Execute or Go icon on the second menu bar, or you may just press F5.  If all goes well, the program will run correctly for you!

Modifying the program. Now lets try customizing the program.
    First, open the file SimpleDraw.c as follows:  On the left window, select File View.  Then find the file SimpleDraw.c in the file view, and double-click it, to open it for editting. 
    Second, find the line glColor3f(1.0,1.0,1.0); which sets the color of the dots and lines.  Replace this by glColor3f(1.0,1.0,0.0 ).  (The last 1.0 changed to 0.0.) 
    Recompile and run the program.  The dots and lines should now be yellow.

    Congratulations!  You now know how to edit, compile and run OpenGL programs!

Using C++/OpenGL Help.  The C++ help information is fairly extensive.  For example, try selecting Index from the Help menu.  Then enter glColor3f, and see the associated documentation.   Standard OpenGL commands are fairly well documented.  The "glut" commands are not documented in the Visual C++ help system, but documentation will be available online.. 

Debugging: Modern compilers, including Visual C++ have sophisticated windows based debuggers.  You should learn how to use these debuggers well enough to (a) set break points, (b) single step, (c) step into and out of function calls, (d) examine the values of variables.  These are all quite simple, and if you do not know how to do this, ask the TA or instructor or another student.

Next task:  Understand how SimpleDraw works.  The first programing assignment will involve modifying SimpleDraw and SimpleAnim.