Saturday, 3 October 2015

Installing FreeGLUT in CodeBlock



Install FreeGLUT (Be Careful )

1.       Download : http://www.transmissionzero.co.uk/software/freeglut-devel/
From above location, download freeglut-mingw.zip
Extract the file in any folder.

2.       Now create two copies of GNU GCC Compiler.

a.       First is 32 bits and copy following files as directed:
        
File
From (FreeGLUT\)
To(MinGW32\)
freeglut.dll
bin
bin and C:\Windows\System32\
Freeglut.h
Freeglut_ext.h
Freeglut_std.h
glut.h  (optional as in previous step)
include\GL
include\GL
libfreeglut.a
libfreeglut_static.a
lib
lib

b.      Second one, 64 bits is other copy for it do as follows:

      File
From (FreeGLUT\)
To(MinGW64\)
freeglut.dll
bin\x64
bin and C:\Windows\SysWOW64\
Freeglut.h
Freeglut_ext.h
Freeglut_std.h
glut.h
include\GL
include\GL
libfreeglut.a
libfreeglut_static.a
lib\x64
lib

3.       Now move to settings of Compiler in CB.
a.  For 32 bits Compiler version,

Don’t forget to update Toolchain Executables as per need ,here, C:\TDM-GCC-32

Linker Settings =>Link Libraries
C:\TDM-GCC-32\lib\libfreeglut.a
C:\TDM-GCC-32\lib\libfreeglut_static.a

In “Other Linker Options”
-lOpenGL32 -lglu32 –lfreeglut

Search Directories Tab => Compiler
C:\TDM-GCC-32\include
Search Directories Tab => Linker
C:\TDM-GCC-32\lib

b.  For 64 bits Compiler version,
Don’t forget to update Toolchain Executables as per need ,here, C:\TDM-GCC-64

For toolchain Executables (in order of appearance)
gcc.exe
g++.exe
g++.exe
ar.exe
windres.exe
mingw32-make.exe

Linker Settings =>Link Libraries
C:\TDM-GCC-64\lib\libfreeglut.a
C:\TDM-GCC-64\lib\libfreeglut_static.a

In “Other Linker Options”
-lOpenGL32 -lglu32 –lfreeglut

Search Directories Tab => Compiler
C:\TDM-GCC-64\include
Search Directories Tab => Linker
                  C:\TDM-GCC-64\lib

4.       Now, create empty project with choosing compiler suitable to your OS. Right click on Project and go to the project properites and Build Targets => build type => GUI application
5.       Now download and extract this zip file:
6.       And place *.h and *.cpp files into CB project locations.
7.       Now again confirm Compiler from Rt Click on project => Build options.
8.       Now rebuild => build => run.

                You will get this output:

No comments:

Post a Comment