Compilation Notes

Windows

Using Visual Studio, download: http://inst.eecs.berkeley.edu/~cs184/sp12/Additional_Libraries.zip
(Visual Studio can be downloaded for free on https://www.dreamspark.com/)

If you are having issues taking screenshots, you can either manually crop a print screen (printscreen button) or use Fraps to take a screenshot, while we figure out the issue.

If you run into issues with 32/64-bit compilation, make sure your platform target says Win32, rather than x64.

To import the required dependencies, copy from Additional_Libraries.zip:
Dll\glew32.dll              to          %SystemRoot%\system32
Dll\glut32.dll              to          %SystemRoot%\system32
Lib\glew32.lib              to          {VC Root}\Lib
Lib\glut32.lib              to          {VC Root}\Lib
Include\GL\glew.h           to          {VC Root}\Include\GL
Include\GL\glut.h           to          {VC Root}\Include\GL
%SystemRoot% on Windows 7 x64 is typically C:\Windows\System32.
{VC Root} for VS2008 is typically C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC,
{VC Root} for VS2010 is typically C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\,
{VC Root} for VS2012 is typically C:\Program Files (x86)\Windows Kits\8.0\include\um for includes
and C:\Program Files (x86)\Windows Kits\8.0\um\x86 for libs.


If it still doesn't work, some students have reported that
Include\GL\glew.h           to          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\GL
Include\GL\glut.h           to          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\GL
Lib\glew32.lib              to          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib
Lib\glut32.lib              to          C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib
Dll\glew32.dll              to          ...hw0\Debug
Dll\glut32.dll              to          ...hw0\Debug
Or
Dll\glew32.dll              to          C:\Windows\SysWOW64\
Dll\glut32.dll              to          C:\Windows\SysWOW64\
Help solve issues as well. Finally, open the .sln file.

The FreeImage Library .DLL is included with the Windows distribution. If you change your build configuration from "Debug" to "Release", you must copy "FreeImage.dll" to the "Release" directory that resides in the project root directory containing the .SLN file.

If you are still having issues, update your drivers and try running HW1 or HW2 instead of HW0. If this works, then just use another machine for HW0 (330 Soda machines work great). If HW1 and HW2 do not work, you may need to find another machine or OS. This only happens for some Windows systems; most are fine. We are looking into resolving this issue.

Linux

If you are using a synaptic-based distribution, like Ubuntu, run:
sudo apt-get install freeglut3-dev glew-utils libglew1.6-dev libfreeimage-dev
to install the required dependencies for our OpenGL assignments. If libglew1.6-dev cannot be found, try installing an older version, such as libglew1.5-dev. Also make sure your package manager is up to date. To compile, finally run make inside the assignment directory. If you do not have make or g++, run:
sudo apt-get install build-essential
on your synaptic-based Linux to install them.

If you are having issues with ATI/AMD Proprietary Drivers, see this Piazza post. You may need to remove fglrx drivers from Ubuntu.

OSX

Download and install Xcode from the App Store, or from http://developer.apple.com/xcode/ You may need an older version if you're on an older OSX version.

If using make, just run make in the assignment directory to compile. By default, neither make nor g++ are installed on OSX. To install them, first open Xcode. From the menu bar, navigate to "Xcode > Preferences". Next, choose the "Downloads" tab. Within Downloads, choose the "Components" tab. Click the "Install" button to the right of "Command Line Tools". This will install the neccessary build tools, such as make and g++.

If you wish to use Xcode's IDE, add GLUT framework (and maybe OpenGL framework also), and change include headers from GL/glut.h to GLUT/glut.h in main.cpp (or anywhere it appears).

You should not need to compile FreeImage for OSX; we provide it with the skeleton code. If you must install it on OSX, it would be simpler to use MacPorts or Homebrew to install the library than to compile it from source.

OSX: Mountain Lion

Thanks to this Piazza post for this tip. If HW0 won't compile, giving you an error like this (with dozens of lines of stuff after):
g++ -g -DGL_GLEXT_PROTOTYPES -I./include/ -I/usr/X11/include -DOSX -c mytest3.cpp
mytest3.cpp:15:21: error: GL/glut.h: No such file or directory
mytest3.cpp:21: error: ‘GLdouble’ does not name a type
mytest3.cpp:22: error: ‘GLfloat’ does not name a type
mytest3.cpp:23: error: ‘GLfloat’ does not name a type
....
Try installing XQuartz (download here). This is necessary because Apple stopped including X11 in Mountain Lion.

Website Initialization

index.html is a page that will contain links to screenshots of results of your assignments, similar to a poartfolio.

To host a website on your instructional account, run the following commands:
mkdir ~/public_html
echo "Hello World" > ~/public_html/index.html
chmod 701 ~
chmod -R 755 ~/public_html
You may need to run
chmod -R 755 ~/public_html
again when you add new files/directories to it. You can open index.html in any text editor and edit the HTML.

Eclipse

If you encounter an error with
enum {FLOOR, CUBE} ;
It should be changed to:
const unsigned int FLOOR = 0 ;
const unsigned int CUBE = 1 ;

General

If the skeleton code does not render correctly, you may want to update your drivers. If this does not solve the issue, running the code on the computers in 330 Soda should work. Note that X11 forwarding may not work correctly, so you may need to use the physical lab machines.

Different systems produce slightly different images. We have set our thresholds in the feedback server accordingly. Don't worry about a few pixels being off, as long as you pass the test.

Ignore compiler warnings if the program runs.

We do not directly offer support for IDEs other than Visual Studio on Windows. If you use XCode or Eclipse, you must generate the project yourself, and make sure it will still compile with the provided Makefiles (on OSX/Linux) or the Sln (on Windows)

If you are getting the error:
ERROR: 0:9: error(#137) 'attribute' supported in vertex shaders only
ERROR: 0:10: error(#137) 'attribute' supported in vertex shaders only
ERROR: 0:11: error(#137) 'attribute' supported in vertex shaders only
Please replace the following lines in shaders/light.frag.glsl (lines 9 through 11):
attribute vec4 color ;
attribute vec3 mynormal ; 
attribute vec4 myvertex ; 
With:
varying vec4 color ;
varying vec3 mynormal ; 
varying vec4 myvertex ;