Short question:
Given the Clojure concurrency model, how can I guarantee that all LWJGL OpenGL Update functions are called from the same thread?
Long question
After a long and glorious battle Using lwjgl in Leiningen / Clojure , I now have LWJGL + Leiningen + Clojure, working together.
However, according to the LWJGL documentation, it seems that OpenGL client commands have a local thread state - and if I call OpenGL commands from different threads, Bad Things (TM) can happen.
So my question is: what is the correct way, inside Clojure, to set up something like Swing Threads (but I can't use Swing Threads / should set up my own) so that:
(1) there is one main thread responsible for all OpenGL calls
(2) other threads do some communication with this main thread to coordinate OpenGL calls
My background
I am familiar with threads in C / C ++. I am familiar with the Clojure agent / atom / ref model. However, I am not familiar with the "manual" concurrency / threading in Clojure.
Thanks!
source share