This document describes how to setup Glut / FreeImage for compiling your applications for COSC 3P98. For the following tutorial you need the Load.c example program, a sample image in tiff format named img.tif. Download these files and jump to the category applicable to your setup.
This setup targets Microsoft Visual Studio .NET 2008 but the steps will be similar for other versions.
In the labs (MCJ 310 and MCD 205), glut and freeimage are already installed and hence you can skip to step 2. If you're installing on your own computer start with step 1.
Note: In Microsoft Visual Studio 2005 the paths to copy the libraries to were C:\Program Files\Microsoft Visual Studio 9\VC\PlatformSDK\Lib and C:\Program Files\Microsoft Visual Studio 9\VC\PlatformSDK\Include.
The OpenGL Utility Toolkit (GLUT) can be downloaded from the Glut website. Download the file glut-X.X.X-bin.zip where X.X.X is the latest version available. Extract its contents and copy the following files to these locations:
FreeImage can be downloaded from the FreeImage Project website. Download the latest FreeImage DLL (i.e. FreeImage X.X.X [Win32]). Extract its contents to a folder and copy the following files to these locations:
Note: Be sure to create a Win32 Console Application and check off "Empty project" when creating a new project
In your project (existing / newly created), navigate to the project properties by clicking on Project > "name" Properties
Navigate to Configuration Properties > Linker > Input. Click in the box for Additional Dependencies and enter the text for the following libraries to be compiled into your application: opengl32.lib glu32.lib glut32.lib freeImage.lib
Note: the glaux.lib library was needed in Visual Studio 2005.
Click OK and you should be able to use Glut and FreeImage in your application. This will need to be done in each new project that uses Glut and FreeImage. To run the Load.c example program you will need to copy or create img.tif in the project folder name/name (for example if your project name is load then you would place the file in the load subdirectory within the load project directory.
In the labs (MCJ 310 and MCD 205), glut and freeimage are already installed and hence you can skip to step 2. If you're installing on your own computer start with step 1.
Depending on your distribution this part of the installation may vary. It is usually best to use your distribution's package manager if it has the libraries in it rather than downloading the libraries from their web sites. The following steps are tailored to Ubuntu (or any other Debian-based) Linux but will likely just need slight modifications to work in other distributions.
Run the following command to download and install the FreeImage and Glut libraries.
sudo apt-get install libglut3-dev libfreeimage-dev
After this, the libraries (and any dependencies) will be installed to the appropriate locations.
When you are compiling your application, you must tell the compiler that you are using OpenGL, Glut, FreeImage, etc. This is done using the -l (lowercase "L") flag in most compilers. For example, if you wanted to compile Load.c you would run the following:
On Ubuntu:
gcc Load.c -o load -lglut -lfreeimage
On the lab computers:
gcc Load.c -o load -lGL -lGLU -lglut -lfreeimage -lX11 -lXi -Xmu
After it compiles you can then run the program by typing:
./load
To run the Load.c example program you need to place or create img.tif in the current directory.
Back to COSC 3P98