Home

Lab 0 - Setting up the development environment

IMPORTANT! In this course, your project must be cross-platform. Follow these guidelines.

Once you set up your environment properly, you should be able to run the lab code and see a teapot.

First, download the lab here, and then extract the zip file to a suitable folder. Then go to the section corresponding to your development environment.

Miscellaneous tips:

  1. Depending on the environment, things may not go smoothly if the path contains special characters. Therefore, I recommend against using SPACE, &, etc. in your path.
  2. Whenever you change your environment variables, you need to restart CMake and your IDE.
  3. Because CMake caches your last-used settings, it must be cleared before running again. Run the command rm -r * from the build folder to delete the cache.
  4. To add new files, rather than adding them through the IDE (e.g., Visual Studio, Xcode), use CMake. Usually, simply rerunning CMake does the trick. If there are a lot of changes to the source folder, it might help to clear the cache (see Tip #3 above) before rerunning CMake.

Setting up Windows

  1. Download and install these programs.

  2. Download and extract the following libraries. You can extract them to your CSCE441 folder or to a system folder of your choice.

  3. Set up the environment variables. This ensures that your code will work on the TA’s and the instructor’s machines.

Setting up macOS

This has been tested on Big Sur and Monterey. Earlier versions may or may not work.

  1. Download and install the following. You can use homebrew/macports or install these manually.

    Make sure the commands g++ and cmake work from the command prompt.

  2. Download and extract the following libraries. You can extract them to your CSCE441 folder or to a system folder of your choice.

  3. Set up the environment variables. This ensures that your code will work on the TA’s and the instructor’s machines.

Setting up Linux

This is for Ubuntu Linux 20.04.1 LTS. Setting up other distributions should be similar but may be slightly different.

  1. You’ll need the following if you don’t have them already.

     > sudo apt-get update
     > sudo apt-get install g++
     > sudo apt-get install cmake
     > sudo apt-get install freeglut3-dev
     > sudo apt-get install libxrandr-dev
     > sudo apt-get install libxi-dev
     > sudo apt-get install libxinerama-dev
     > sudo apt-get install libxcursor-dev

    We are going to install GLM, GLFW, and GLEW manually. (You may also use a package manager to get these libraries, but please do not modify the CMake file.)

  2. Download and extract the following libraries. You can extract them to your CSCE441 folder or to a system folder of your choice.

  3. Set up the environment variables. This ensures that your code will work on the TA’s and the instructor’s machines.

Run with Visual Studio

  1. Extract L00.zip into a folder of your choice.

  2. Run CMake (GUI).

    1. Click on “Browse Source…” and point to the folder you extracted, containing the CMakeLists.txt file.
    2. Copy and paste the path from above to “Where to build the binaries.” Append “build” to it.
    3. Click on “Configure.” Click on “Yes” if it asks if you want to create a directory. Select the Visual Studio version that is installed on your machine (e.g., “Visual Studio 16.2.5 2019”) and click on “Finish.” You should see “Configuring done” in the scroll panel.
    4. Click on “Generate.” You should see “Generating done” in the scroll panel. Close CMake.
  3. There should now be a file called L00.sln in the build folder. Double click it to open it with Visual Studio.

    1. Right-click on L00 and select “Set as StartUp Project.”
    2. Right-click again on L00 and select “Properties.” Go to “Debugging” then “Command Arguments” and then type ../resources. Click “OK.”
    3. Go to the “Build” menu and click “Build Solution [F7].”
    4. Go to the “Debug” menu and click “Start Debugging [F5].” You should see the teapot.
    5. To run in Release mode, change the solution configuration by clicking on “Debug” in the drop-down menu.

Run with Xcode

  1. Extract L00.zip into a folder of your choice.

  2. In the folder that contains CMakeLists.txt, run the following.

     > mkdir build
     > cd build

    Then run the following from the build folder.

     > cmake -G Xcode ..

    This will generate L00.xcodeproj project that you can open with Xcode.

  3. Open L00.xcodeproj with Xcode.

    1. Change the target by clicking on “ALL_BUILD” and selecting L00.
    2. Edit the scheme by going to “Product” -> “Scheme” -> “Edit Scheme” to add command-line arguments (../../resources).
    3. Press Command+B to build.
    4. Press Command+R to run.
    5. To run in release mode, edit the scheme again and go to the “info” tab.

Run with Makefile

  1. Extract L00.zip into a folder of your choice.

  2. In the folder that contains CMakeLists.txt, run the following.

     > mkdir build
     > cd build

    Then run the following from the build folder.

     > cmake ..

    This will generate a Makefile that you can use to compile your code.

  3. To compile the code, run the generated Makefile.

     > make -j4

    The -j argument speeds up the compilation by multithreading the compiler. This will generate an executable, which you can run by typing

     > ./L00 ../resources

    To build in release mode:


Generated on Thu Aug 17 10:49:05 CDT 2023