cl-opengl-thomas mac os x bindings with native GLUT.framework

I got the information that the branch I used in the previous version is an older one and that I should migrate to the so called thomas branch.

So I did it and now it seems that all examples are working. Ok … the varray example is not working. It somehow is not willing to compile for me and I am too lazy to look into this problem. (perhaps next time)

You can get it here.

Have fun!

7 thoughts on “cl-opengl-thomas mac os x bindings with native GLUT.framework

  1. Johnny

    Did you send your patches to the cl-opengl
    maintainers ? That would be a great idea,
    as cl-opengl (from their repos) is a joke
    prod on OSX with the X11 and freeglut dependencies.

  2. Johnny

    Also, i forgot to mention that even with your patches, cl-opengl does not work correctly. Here (sbcl/osx/ia32 with threads) starting a glut example from inside emacs/slime results in a window with no titlebar and no way to quit (beachball). This is because the glut event loop needs to run on the main thread of the application something which does not happen if you run it inside emacs/slime (as a second thread is used for the repl)

    Also, you do not seem to use glutWMCloseFunc to define the operation on window close (so that it doesnt exit
    and kill the lisp)

    So, summarizing, what i think should
    happen for a native working opengl binding for osx that operates correctly
    within slime/emacs is:

    Use glutCheckLoop() for events as you currently do
    Use glutWMCloseFunc to avoid killing the lisp when glut window closes
    Run glut event loop in main thread of lisp (this is necessary)

    I do not understand why the cl-opengl maintainers do not adopt this approach and they still insist on advocating freeglut for OSX and misrepresenting
    the issue. They are well aware of these functions and there is no reason to use freeglut and X11 for lisp+opengl in OSX.

    The sorry state of affairs that is cl-opengl and cffi (and anything luis touches apparently) do not inspire confidence as per the future direction
    of these projects.

  3. Coder

    Excellent work!
    I’ve been struggling with cl-opengl on the mac, and having it native it great. I still have some stability issues, but hopefully you’ll get the code into a repository or better yet, contribute it back to the cl-opengl project.
    Thanks for your efforts and excellent blog.

  4. ice

    I too have the problem with no titlebar and beachballing, which is a shame as native cl-opengl would be really nice.

    What did work was the render-to-texture example which did not run for me using FreeGLUT.

  5. kamil

    Glut sucks. Have you tried cl-glfw bindings? It works fine on mac os x. I run a lisp image with swank and cl-glfw loaded, and a main event loop, and then connect from slime/emacs to it. Everything works fine including the title bar.

  6. esden

    All right, I think I have to answer some Questions here finally!

    I currently have no time to work on that library so there will not be any updates in the near future. My Diploma Thesis and work suck up all my time.

    @Johny Thank you very much for the tips! I will for sure include them when I find time to work on that patch.

    @Coder As soon as I have time to review my changes and make them mergable with the main tree I will for sure contribute it.

    @kamil Thank you very much for the link. I took a brief look at the glfw library, it looks very promissing. I will test it soon and write about it.

    All of it may take some time because as I already said my time is currently very limitted. Does someone have a time multiplicator? 😉

  7. Johnny


    GLFW is carbon only and requires another
    dependency. If someone is considering going this route, he might as well go for SDL which is widely used in contrast to GLFW which i doubt a lot of ppl have heard of.

    The fact that GLUT is fairly simple and
    unsuitable for a lot of projects should not mean that its useless as this is not true. GLUT a very good solution for rapid, interactive opengl development since its present everywhere and it should be supported natively on the mac as it is in linux. Naive solutions like freeglut/x11/mac are not the way forward.


Leave a Reply

Your email address will not be published. Required fields are marked *

Question: *