
Am Freitag, 31. Juli 2009 17:25:45 schrieb Michael [Plouj] Ploujnikov:
[...] Finally, this is what I get if I try to compile with 'ghc --make':
$ ghc --make -lglut SmoothOpenGL3.hs # the linker fails without -lglut similar to this: http://www.haskell.org/pipermail/hopengl/2008-September/000756.html
I don't know what's going on here, things work for me without -lglut on openSUSE 11.1. Which OS/distro are you using? It is hard to debug without actually seeing it fail for oneself. Anyway, I am in the process of changing the GLUT package to use dynamic linking internally, too, and the autoconf dependency will be removed as well. If you like, you could give the code on http://darcs.haskell.org/packages/GLUT/ a try and tell us about your results. Hopefully such linking issues will be a thing of the past... (famous last words ;-)
[1 of 1] Compiling Main ( SmoothOpenGL3.hs, SmoothOpenGL3.o ) Linking SmoothOpenGL3 ... $ ./SmoothOpenGL3 SmoothOpenGL3: user error (unknown GLUT call glutInitContextVersion, check for freeglut)
That's OK: To create an OpenGL 3.x context, you need a recent version of freeglut. Classic GLUT and older versions of freeglut simply do not have the API entries glutInitContextVersion and glutInitContextFlags. I really, really hope that the freeglut project admins make a release soon. I am active in this project, but I can't make releases. There are a few GL/GLX extensions I'd like to add to freeglut, too, but only after a release. Depending on your OpenGL driver, you can make things work by using ./SmoothOpenGL3 classic This will create a "normal" (i.e. legacy) context, which might work, too. Perhaps you have to change the GLSL "#version 140" to "#version 130", your mileage may vary, but this is a driver issue, and OpenGL 3.1 is really still on the bleeding edge. NVIDIA's 190.18 drivers work fine for me on openSUSE x86_64. Note that SmoothOpenGL3 is perhaps not the most elegant way to use OpenGL 3.x, it is my first shot at a "pure" OpenGL 3.1 program which does not use any deprecated functionality, only shaders, vertex arrays in buffer objects, hand-calculated matrices, etc. From this example one can see that the OpenGL package misses a Haskell representation of the various GLSL matrix types, but that is a topic for a different mail thread. :-) Cheers, S.