[MLton] OpenGL

Stephen Weeks MLton@mlton.org
Wed, 21 Jan 2004 20:24:51 -0800

> That's unfortunate - you need glut.h.  As you might have guessed I'm not up
> on the latest Linux stuff but Google just turned this up re installing GLUT
> and RH 9.0:
> http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/015138.html

Thanks for the link.  I went ahead and installed the rpms for RedHat 8
as suggested by one poster at opengl.org.  With that in place, some
case sensitivity fixes, and the right linker args, I built and ran:
atom, hello, shortest, solar, spin_cube, and triangle.  Quite neat!

BTW, when I run, I get the following warning.

  Xlib:  extension "XFree86-DRI" missing on display ":0.0".

As to the changes, you might want to add GLUT_h.h, GLU_h.h, and GL_h.h
to the .cvsignore.  Also, I created GL.cm with the contents

  Group is

(note the case).  I tweaked all the other .cm files to refer to this.
E.g. atom.cm is

  Group is

Finally, I changed the Makefile as below.

BTW, in my cygwin.bat file I have

	set CYGWIN=binmode check_case:strict ntsec tty 

I believe the check_case:strict makes Cygwin case sensitive, which
might be good to do while you're developing code that has to work on
Linux too.

Overall, it looks great.  I'm looking forward to running blender.


Index: Makefile
RCS file: /cvsroot/mlton/mlton/lib/opengl/mlton/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- Makefile	21 Jan 2004 07:55:09 -0000	1.10
+++ Makefile	22 Jan 2004 04:17:05 -0000
@@ -1,6 +1,6 @@
 mlton = mlton
 MLTONFLAGS = -verbose 0
-GL_LINK_OPTS = -link-opt -L/lib/w32api -link-opt -lglut32 -link-opt -lglu32 -link-opt -lopengl32
+GL_LINK_OPTS = -link-opt '-lglut -lGLU -lGL'
 CPPFLAGS =  -P -C -x c -E
@@ -79,25 +79,25 @@
 test: shortest hello solar atom triangle spin_cube blender
 shortest: $(GLUT_SML) $(GL_SML) shortest.sml
-	mlton $(GL_LINK_OPTS) shortest.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) shortest.cm GL_c.o GLUT_c.o
 hello: $(GLUT_SML) $(GLU_SML) $(GL_SML) hello.sml
-	mlton $(GL_LINK_OPTS) hello.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) hello.cm GL_c.o GLUT_c.o
 solar: $(GLUT_SML) $(GLU_SML) $(GL_SML) solar.sml
-	mlton $(GL_LINK_OPTS) solar.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) solar.cm GL_c.o GLUT_c.o
 atom: $(GLUT_SML) $(GLU_SML) $(GL_SML) atom.sml
-	mlton $(GL_LINK_OPTS) atom.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) atom.cm GL_c.o GLUT_c.o
 triangle: $(GLUT_SML) $(GLU_SML) $(GL_SML) triangle.sml
-	mlton $(GL_LINK_OPTS) triangle.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) triangle.cm GL_c.o GLUT_c.o
 spin_cube: $(GLUT_SML) $(GLU_SML) $(GL_SML) spin_cube.sml
-	mlton $(GL_LINK_OPTS) spin_cube.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) spin_cube.cm GL_c.o GLUT_c.o
 blender: $(GLUT_SML) $(GLU_SML) $(GL_SML) blender.sml
-	mlton $(GL_LINK_OPTS) blender.cm Gl_c.c Glut_c.c
+	mlton $(GL_LINK_OPTS) blender.cm GL_c.o GLUT_c.o
 	rm -f *_h.h *.stackdump *~ *.o *.exe Glut *.a hello shortest atom solar triangle spin_cube blender