You are on page 1of 9

Compiling Angel 6

th
edition code on Code::Blocks

Please note that to be able to compile Angels 6
th
edition code your GPU must support opengl 3.2
or higher.

Download code.zip from additional resources/code myunisa. Copy the files and folders in the
mingw/lib and include folders to C:\Program Files(86)\CodeBlocks\mingw\lib and include.

Check to see if you have OpenGL 3.0 support using GPU Caps Viewer. Program is available on
myunisa-additoinal resources.





If you dont have opengl 3.0 support then you need to find the latest driver for your graphics
card. If you card is unable to support opengl 3.0 then you wont be able to compile 6
th
edition
code. You need to then do your assignments using nonshader based immediate mode opengl
(Angel 5
th
edition code). This code compiles easily under mingw (Code::blocks or even dev c++)
.

In Code::Blocks, make a new console application

















Once you have created your project you should copy lnitShader.cpp from the zip
folder in the common directory to the directory of your project. Add that file to
your project by right clicking on the name of your project and selecting Add
files














Select InitShader.cpp and then select Open


Press OK





Select lnitShader.cpp and then select Open








Press OK







Now InitShader.cpp is in your project



Select a sample project to work from. Replace the code in main.cpp with whichever sample
project you decide to work with. In our example, we will be working with
CHAPTER02_CODE\WINDOWS_VERSIONS\ example3.cpp

Once you have copied this file into main.cpp locate the following lines:

// Load shaders and use the resulting shader program
GLuint program =InitShader( "vshader23.glsl", "fshader23.glsl" );

This tells the InitShader to make use of the following files vshader23.glsl and fshader23.glsl.
You need to have them in your project directory. Please copy them to the directory where you
stored you main.cpp file. Each program will use different shader files, so please make sure the
proper files are copied before you run your program or you will get runtime errors.












From the Code::Blocks menu select Project, Build Options.



.




From the Build Options select #defines and type into the box(dont forget to click on debug on
the left hand side):

FREEGLUT STATIC
GLEW STATIC


















.


In the linker settings tab, select to Add




Now add in the following libraries:( click on add and then to browse for the folder)



You need to look in Program Files (x86) and not Program Files if you have a windows 7/8
machine. The order of libraries above is important



Select No.



When done press OK.

Test the project by pressingF9. Hopefully you get the following window which means that
the project compiled and built correctly.

Help

If when running you get a context profile error please comment out the following lines of code
in the int main function.

glutInitContextVersion( 3, 2 );
glutInitContextProfile( GLUT_CORE_PROFILE );

If you get Iinker errors,make sure you setup the libraries in the linker settings in the correct
order.

If at the time of running the program, you get a "failed to read ..." message, this means you
forgot to place the shader files within the directory of your project.