CSCI 4530/6530 - Spring 2012
Advanced Computer Graphics
Home
  Contact Information
  Office Hours

Announcements
  LMS

Syllabus
  Prerequisites
  Textbook

Grading
  Assigned Readings

Calendar
  Lecture notes
  Lab materials
  Homework
  Test reviews

Homework
  Collaboration Policy
  Compilers
    CMake notes
    gcc/g++ notes
    GL/glut notes
    memory debugging
  Homework Late Policy
  Electronic Submission

Final Project
   Spring '12 Projects
   Spring '11 Projects
   Spring '10 Projects
   Spring '09 Projects
   Spring '08 Projects
   Spring '07 Projects

Academic Integrity

Using CMake

This semester we will be using CMake, a cross-platform, open-source make system. The provided homework code will be developed on MaxOSX using CMake/g++, but has been tested and should also work on Linux using CMake/g++, and Windows using CMake/VisualStudio.

When you start a new assignment/project, you should first run cmake on the provided code following the directions below. These steps allow you to setup the build environment, verify installation of all libraries, ensure the project correctly compiles and links, and allows you to test the initial executable. These steps create the Makefile or Visual Studio project file for your system. Once completed you can launch your favorite source code editor or Integrated Development Environment (IDE) and start working on the assignment.

Please let the instructor know if you catch any portability bugs while working on the homework (and post bug fixes to LMS for the other students). Also, please share any installation/compilation instructions you have for your specific environment.

On Linux or MacOSX

  • Install CMake and GLUT (see GL/glut notes)

  • Make a directory for your source code for this project (e.g., hw1/src). Put the CMakeLists.txt file, and all your .cpp and .h files in that directory.

  • Make a directory for building this project (e.g., hw1/build). Open up a terminal/shell and cd into the build directory. Then run CMake giving it the source code directory. E.g.,

      cmake ../src
    

    This generates a Makefile in the current directory.

  • Now build the program:

      make
    

    Your executable will be in the current directory.

  • To run the program, and refer to a data file that is in the src directory, you'll type something like this:

      ifs -input ../src/fern.txt 
    

  • If you add new .cpp files, be sure to add them to the CMakeLists.txt file.

  • To rebuild the program after changing the souce files, just type make.

On Windows with Visual Studio

  • Install Visual Studio

    Note: Visual Studio 2008 users will probably need to install Visual C++ 2008 Feature Pack Release to get Standard Library TR1, which includes unordered_map (and change provided code to from std::unordered_map to std::tr1::unordered map)

  • Install CMake
    Note: Windows CMake should be on the path ahead of Cygwin CMake. (This is a common mistake!)

  • Install GLUT (see Chris Wyman's detailed instructions for Windows)
    Placing the .h, .lib, and .dll files as described, and editing your path as necessary.

  • Install GLEW, http://glew.sourceforge.net/
    Placing the .h, .lib, and .dll files similarly to GLUT.

  • Make a directory for your source code for this project (e.g., hw1/src). Put the CMakeLists.txt file, and all your .cpp and .h files in that directory.

  • Make a directory for building this project (e.g., hw1/build).

  • Launch the Visual Studio command shell (not just the cmd shell). From the Start menu, under All Programs, find your Visual Studio version (e.g., 2010) and expand it. Then expand Visual Studio Tools. Select the "Visual Studio 2010 Command Prompt".

  • Within the Visual Studio command shell, navigate (using cd) into the build directory. Then run CMake giving it the source code directory. E.g.,

      cmake ../src
    

    It should say something like: "Building for: Visual Studio 2010"
    Hopefully it finds all the necessary libraries and completes successfully!

    If complains about GLUT or GLEW not being found, make sure you have installed them correctly. (NOTE: You need to re-launch the Visual Studio command shell after installing new libraries).

  • Now actually run the compiler:

      cmake --build . 
    

    And hopefully the build is successful and you have an executable will be in Debug/your_program.exe or debug/your_program.exe

  • To run your executable with a data file in the source directory, type something like this:

      debug/ifs.exe -input ../src/fern.txt
    

  • Once your build environment is setup, you can launch the Visual Studio IDE by opening the solution file (named XXX.sln). E.g.,

      start hw0.sln
    

Other Important OpenGL Compilation Notes:

  • Make sure you have recent graphic card drivers (download the specific driver for your card from NVidia, ATI, or Intel rather than the default Linux or Microsoft driver).

  • WARNING: OpenGL features beyond OpenGL 1.1 generally do not work over Remote Desktop