In my program, I load meshes in different threads. However, it seems GL commands need to be executed in the thread that holds the GL context.
Probably I am doing things in a very wrong way, but my solution to this problem was:
Set up a FrameListener with a queue of lambda functions.
https://github.com/andre-caldas/ParaCAD ... ueue.h#L40When "frameRenderingQueued()" runs, it just executes all lambdas registered in the queue.
https://github.com/andre-caldas/ParaCAD ... ue.cpp#L29The mesh is "prepared" normally, but when it is to be loaded, it registers a lambda function in the queue.
https://github.com/andre-caldas/ParaCAD ... h.cpp#L301
OBS: Registering the listener happens here:
https://github.com/andre-caldas/ParaCAD ... sh.cpp#L43
This ensures (I hope!) the listener is registered only once.
Seems to be working. But I wonder if I shouldn't use "frameEnded()" instead of "frameRenderingQueued()", because it might be not correct to change the buffers just before swapping them.