Hi Geoffrey,
I managed to get the F<examples/opengl/triangle.pir> running on Windows
XP SP3, VC++ 9.0, using Parrot r27789. There are glitches involved,
though. I'll just explain what I did.
First I checked the OpenGL install on my box. I have the "Windows SDK
for Windows Server 2008 and .NET Framework 3.5" installed which contains
the necessary OpenGL headers and libs. It's installed at C<C:\Program
Files\Microsoft SDKs\Windows\v6.1>. The relevant files are:
Include/gl/GL.h
Include/gl/GLU.h
Lib/OpenGL32.Lib
Lib/GlU32.Lib
The DLLs are:
C:\WINDOWS\system32\opengl32.dll
C:\WINDOWS\system32\glu32.dll
I added GLUT [1] (glut.h, glut32.lib and glut32.dll), as it wasn't present.
Then I hacked F<config/auto/opengl.pm> and F<config/gen/opengl.pm> to
look for these files.
win32_nongcc => 'opengl32.lib glu32.lib glut32.lib'
To answer question 1., the location of the headers depends on the used
installation and version. I don't think there's an easy way to specify
an absolute file glob. On the bright side, there are the environment
variables C<Include>, C<Lib> and C<Path>, containing a semicolon
separated list of directories that are searched by the compiler and linker.
After that I modfied F<runtime/parrot/library/OpenGL.pir> to look for
the relevant DLLs by adding the following to the relevant sections.
push libnames, 'opengl32'
push libnames, 'glu32'
push libnames, 'glut32'
Interestingly, when saying C<opengl32.dll> instead of C<opengl32> it
seems like one needs to specify the full path to the library.
Things get a bit more interesting with F<src/glut_callbacks.c>. First,
I needed to modify the link directive in F<Makefile> to:
$(LIBGLUTCB_SO): $(LIBPARROT) $(SRC_DIR)/glut_callbacks$(O)
$(LD) $(LD_LOAD_FLAGS) $(LDFLAGS) \
@[EMAIL PROTECTED]@ $(SRC_DIR)/glut_callbacks$(O) $(ALL_PARROT_LIBS)
Note the missing C<@ncilib_link_extra@> and the replacement of
C<$(C_LIBS)> with C<$(ALL_PARROT_LIBS)>.
C<@ncilib_link_extra@> contains the directive to export test symbols
from libnci, which are not present with the callback library, leading to
a link error. I needed to replace C<C_LIBS> with C<ALL_PARROT_LIBS>
because the callback contains references to libparrot.
Finally, I added the following to F<src/glut_callbacks.c>.
#define PARROT_IN_EXTENSION
And did a C<s/PARROT_API/PARROT_DYNEXT_EXPORT/> on the file.
After all this hard work I called C<parrot examples\opengl\triangle.pir>
and enjoyed the triangle to rotate, and rotate, and rotate (still
wondering when it'll stop...)
Ron
[1] http://www.opengl.org/resources/libraries/glut/
Geoffrey Broadwell wrote:
Thanks to tetragon++, I've now got OpenGL header parsing (mostly)
working on both Debian Linux/i386 and Mac OS X 10.5. Now I need headers
for Windows to continue the porting work.
For each of MSVC, MinGW, and cygwin, I need:
1. Path globs [1] for all OpenGL headers, in the form
'/path/to/dir1/*.h', '/path/to/dir2/*.h'
2. A tarball or zip archive of all of these headers
Any volunteers who can send me the above for one or more of the Windows
compiler environments?
Thanks in advance!
-'f
[1] No really, I need the full path globs. I'm actually parsing the
headers myself, not just trying to get C code to compile. :-)