step 2: add minGW to path -> right click my computer and go to properties, select advanced settings, then environment variables. under system variables find Path and edit it. add a ; and then the path to the bin folder where you installed minGW. mine went into C:\MinGW\bin
step 3: download the source code for freeglut and compile using minGW. Open a command prompt and go to the src directory of freeglut. use the following commands for 64 bit to get the shared library (dll)
gcc -O2 -c -DFREEGLUT_EXPORTS *.c -I../include
gcc -shared -o freeglut64.dll *.o -Wl,--enable-stdcall-fixup,--out-implib,libfreeglut64.a -lopengl32 -lglu32 -lgdi32 -lwinmm
and for the static library
gcc -O2 -c -DFREEGLUT_STATIC *.c -I../include
ar rcs libfreeglut64_static.a *.o
for 32 bit systems go to http://pinyotae.blogspot.com/2010/05/build-freeglut-with-mingw.html for the commands
step 3: copy freeglut.dll into C:\Windows\SysWOW64 (or C:\Windows\System32 for 32 bit systems)
step 4: Copy the contents of the include\GL from the freeglut directory into the MinGW\include\GL directory
step 5: copy libfreeglut64_static.a and libfreeglut64.a into the minGW\lib directory.
step 6: download and extract eclipse. When i tried to get the 64 bit version of eclipse it crashed so I tried the 32 bit and that worked
step 7: to make a new project in eclipse (taken from http://tjwallas.weebly.com/5/post/2010/11/opengl-development-on-windows-7-freeglut-eclipse-gnu-cc-compiler-mingw-ftw.html)
Uncheck "Show project type and toolchains ...."
4. Make sure MinGW GCC is selected from the list of toolchains on the right.
5. Enter a name for your project and then click finish.
5. Enter a name for your project and then click finish.
6. Right click your project main folder from the project explorer and click properties.
7. From the left menu expand C/C++ build and click settings.
8. From the submenu that appears Click Libraries, which is found under MinGW C++ linker add the following libraries using the tiny add button at the top-right: "glu32" , "opengl32" , "freeglut" (Without the quotes). Then finally, click ok.
7. From the left menu expand C/C++ build and click settings.
8. From the submenu that appears Click Libraries, which is found under MinGW C++ linker add the following libraries using the tiny add button at the top-right: "glu32" , "opengl32" , "freeglut" (Without the quotes). Then finally, click ok.
I also added glew32 as well. also, as I am using freeglut64 i add freeglut64 instead of just freeglut
Step 8: To get Glew set up... glew is only compiled for visual studio so you have to download the source code (http://glew.sourceforge.net/) and compile it using minGW (http://stackoverflow.com/questions/6005076/building-glew-on-with-mingw)
gcc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.c
gcc -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
# Create library file: lib/libglew32.dll.a
ar cr lib/libglew32.a src/glew.o
gcc -DGLEW_NO_GLU -DGLEW_MX -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.mx.o -c src/glew.c
gcc -shared -Wl,-soname,libglew32mx.dll -Wl,--out-implib,lib/libglew32mx.dll.a -o lib/glew32mx.dll src/glew.mx.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
# Create library file: lib/libglew32mx.dll.a
ar cr lib/libglew32mx.a src/glew.mx.o
# Make the glew visualinfo program. Skip this if you want just the lib
gcc -c -O2 -Wall -W -Iinclude -o src/glewinfo.o src/glewinfo.c
gcc -O2 -Wall -W -Iinclude -o bin/glewinfo.exe src/glewinfo.o -Llib -lglew32 -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
gcc -c -O2 -Wall -W -Iinclude -o src/visualinfo.o src/visualinfo.c
gcc -O2 -Wall -W -Iinclude -o bin/visualinfo.exe src/visualinfo.o -Llib -lglew32 -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32Finally you have to copy the Glew include/GL files into the minGW/include/GL directory
copy the glew lib */.dll files into the C:\windows\SysWOW64 directory
copy the other files in the lib directory (*.a files) to the minGW/lib directory
i hope that is it...
test code was downloaded from http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/SIXTH_EDITION/

No comments:
Post a Comment