Closed anthgur closed 10 years ago
You are correct that functions in defscreen
are run on the GL thread; their execution is determined by LibGDX, so this is guaranteed. Running commands in a REPL is certainly a major reason for having on-gl
, but it is also useful when running code in a separate thread using, for example, future
or pmap
. I don't think there is a documented way to know which functions must be run on the GL thread, but you can usually tell just by thinking about whether it would need to interact with OpenGL in some way.
When should
on-gl
be used? I've noticed that you need to use it from the repl to callscreenshot!
andset-screen!
.Do the functions given to
defscreen
get executed in the gl context automatically? If so, how? If not, calls toscreenshot!
will need to be wrapped inon-gl
or it with throw an exception due to not having the gl context (from the call toScreenUtils/get...Pixels
). I thought I would ask, because I'm not sure how to test it other than building an uberjar for play-clj and running one of the example projects with it.Is there a way to tell which functions will need the gl context without trying them manually?