First of all - I had a lot better luck using MinGW through MSYS than I did with cygwin. Cygwin tends to chock on windows \r characters, which seem to crop up through the pkg-config utility and then spread like a sick disease. There also may be conflicts between it and the MinGW toolchain. You can read about some of these issues here.
The general gist of things is that you should install MinGW with MSYS, then follow the instructions in the GTKGlExt zip file, but you need to remove some references to pangox. More complete instructions follow:
1) Download MinGW. It can be had from http://www.mingw.org/. When you start installing it, be sure to check the box for MSYS. Also, I recommend installing it to the default location - C:/MinGW/
2) Install GTK+. I personally use the bundle, available from http://www.gtk.org/download-windows.html I download the All-in-one bundle, version 2.22. I unzip the contents to C:/gtk+bundle/ Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
3) Download GTKGlExt. I specifically downloaded the 1.2.0 Release from 2006. Open up the archive, if you do not have a program that will handle this file, 7-Zip is free and it should work. I recommend decompressing the files to C:/gtkglext/ . The docs folder should then be C:/gtkglext/docs. It should NOT be C:/gtkglext/gtkglext-1.2.0/docs. Do NOT use a directory with spaces in it, as this will screw up the pkg-config utility.
4) Open C:/gtkglext/configure in a text editor. And remove all references to pangox.
Delete lines like these:
pangox >= 1.0.0 \\And remove the pangox from inside this line:
GDKGLEXT_PACKAGES="gdk-2.0 pango pangox gmodule-2.0"This step may break compatibility with linux, but, you should probably have a separate copy for that anyway. Maybe someone out there who is more experienced than I can fix this issue so we don't have to do this? You can read more about that here.
5) Various files have old deprecated macros in them. These replacement functions were found in the GtkWidget documentation page in the GTK+ Reference Manual.
Macro GTK_WIDGET_REALISED needs to be replaced with function gtk_widget_get_realized. The parameters are the same. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - lines 130, 157, 177, 197, 254, 435, 477, 504
Macro GTK_WIDGET_TOPLEVEL needs to be replaced with function gtk_widget_is_toplevel . The parameters are the same. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - line 177
Macro GTK_WIDGET_NO_WINDOW needs to be replaced with function !gtk_widget_get_has_window. The parameters are the same. Note the logical "NOT" operator, the new function has the opposite behavior as the old macro. Do this at:
- c:\gtkglext\gtk\gtkglwidget.c - line 253 - Note that adding a NOT operator to this line would yield, 2 NOTs, so you can just remove the existing NOT instead of adding one.
7) Open up MinGW Shell from the Start menu. This will give you a linux-like bash shell for you to enter commands. It is very helpful to understand how to use bash when doing these sorts of things.
Some things to note:
- To get to your C: drive you would go to the directory /c/ by entering:
- Symbolic links don't exist in MSYS. If you try to make one, it actually makes a copy of the directory. This can lead to confusion later.
cd /c/gtkglextJust as a note, if you do as recommended in the README.win32 file and enable the --enable-debug=yes option, this will create errors. I have a post about this here.
env CC='gcc -march=pentium' \
./configure --prefix=c:/gtkglext \
At this point you should have the libraries and DLLs built. The next logical step is to build the examples.
9) This step is needed because pkg-config likes to leave carriage return characters in its output. Open up the file c:/gtkglext/examples/Makefile.mingw and pipe the pkg-config output through the command tr -d "\r" in lines 9 through 11. They should look like this (I apologize that blogger is wrapping the lines, disregard that):
INCLUDES := $(shell pkg-config --cflags gtkglext-1.0 pangoft2)after:
LIBS := $(shell pkg-config --libs gtkglext-1.0)
LIBS_WITH_PANGOFT2 := $(shell pkg-config --libs gtkglext-1.0 pangoft2)
INCLUDES := $(shell pkg-config --cflags gtkglext-1.0 pangoft2 | tr -d "\r")10) Now at the MSYS prompt, type the following lines (be sure that you have have the previous PATH and PKG_CONFIG_PATH commands from before):
LIBS := $(shell pkg-config --libs gtkglext-1.0 | tr -d "\r")
LIBS_WITH_PANGOFT2 := $(shell pkg-config --libs gtkglext-1.0 pangoft2 | tr -d "\r")
$ cd /c/gtkglext/examples11) Run an example program, my favorite is shapes.exe:
$ make -f Makefile.mingw
$ shapes.exeAt this point you have a running program. If you close MSYS and you want to run the programs in the future, you will need the DLLs. One simple way to do this is to copy the exe file you want to run to a new folder, and copy the DLLs from c:/gtk+bundle/bin and c:/gtkglext/bin into the same folder with the exe. At that point you can run it any time you want.
I plan to follow up soon with an explanation of how to setup a project in Eclipse that includes everything you need to use GTKGlExt. At that point you can easily experiment with some code of your own! Check back later!