Imagine my delight upon reading this in the Perl 6 Design Team minutes:

* also had a contact from someone who wants to port OpenGL to Parrot
  * not Geoff Broadwell
  * seems like a very serious approach

Ouch!  You wound me, sir!

Just for the record, I've attached my OpenGL/GLUT proof of concept.

The call_list patch must be applied to call_list.txt to add the new NCI
signatures I am using (these are *FAR* from a complete set, just what I
have actually used in the proof of concept code).

The tarball contains the following files:

    runtime/parrot/library/OpenGL.pir -- PIR wrapper for GLUT/OpenGL
    runtime/parrot/library/gen_glut_callbacks.pl -- generates next file
    runtime/parrot/library/glut_callbacks.c -- GLUT callback handling
    examples/opengl/triangle.pir -- simple test/demo of OpenGL library
    make-glut -- harcoded script to make a .so from glut_callbacks.c

To try this out, you should:

1. Make sure you have freeglut installed; no graceful degrading yet for
   really ancient GLUT implementations.
2. Update to the latest Parrot source tree (I'm on r26609 right now).
3. cd to the top level of the source tree and stay there.
4. Apply the patch for call_list.txt.
5. Configure and make Parrot.
6. Frob make-glut until it works for you; I'm on linux-i386.  Sorry that
   I have not had time to merge this into the normal build.
7. Run ./make-glut to create runtime/parrot/dynext/libglutcb.so .
8. Run ./parrot examples/opengl/triangle.pir to test that it all worked.

I believe that the GLUT callback code is complete -- that was my huge
sticking point previously -- but most of the other stuff is pretty
minimal.  There are a few abstractions in OpenGL.pir that may be useful
for other libraries, but they have not yet been factored into a separate
PIR file.

I have also attached a trivial patch to tools/dev/cc_flags.pl that makes
it notice a DEBUG_CC_FLAGS environment variable telling it to spit out
the complete command line for each cc call.  This was very helpful when
creating make-glut, and may be helpful for bending it to other operating
systems (assuming no one just makes the real build system generate
libglutcb.so properly).

Anyway -- Bob, you're up.  :-)


-'f

Attachment: parrot-opengl-2008-03-28.tar.gz
Description: application/compressed-tar

=== src/call_list.txt
==================================================================
--- src/call_list.txt	(revision 4408)
+++ src/call_list.txt	(local)
@@ -278,6 +278,14 @@
 p    ptp
 i    pt33
 
+# Used by OpenGL (including GLU and GLUT)
+v    3p
+v    PP
+v    PPi
+v    PPii
+v    fff
+v    ffff
+
 # For python
 i    JPP
 
=== tools/dev/cc_flags.pl
==================================================================
--- tools/dev/cc_flags.pl	(revision 4409)
+++ tools/dev/cc_flags.pl	(local)
@@ -139,6 +139,8 @@
     exit;
 }
 
+print "@ARGV\n\n" if $ENV{DEBUG_CC_FLAGS};
+
 exit system(@ARGV) / 256;
 
 # Local Variables:

Reply via email to