ofThread issue with fbo

Hi i am running at some trouble with an project on mac which uses threads and fbo. I have an instance of a class which is running a database update each 30 seconds in a thread. I stores the data and after this it is drawing the position data as polyline in a fbo. i have also another instance of another class which is also drawing some stuff inside a fbo. In the of app, i draw the fbo from the not threaded instance and if the thread send it is not locked it should also draw the threaded fbo. but it crashed every time, also if i commented out drawing the threaded fbo.
this is the code of the threaded function:
while (isThreadRunning())
{
sleep(SLEEPTIME);
ofMessage locked(“db1”);
ofSendMessage(locked);
updateTracker();
ofMessage unlocked(“db0”);
ofSendMessage(unlocked);
drawAllLinesToFbo();
}

the error is:
thread12:
0 glgetintegerv
1 glrenderer::get native viewport
2 glrenderer::get current viewport
3 ofgelrenderer::pushview()
4 ofpushview()
5 offbo::begin(bool)

has anybody an suggestion why this happened? thanks in advance.

most opengl commands can’t be used from multiple threads, you’ll need to send some kind of message from one thread to another and only draw in the main thread when receiving that message

thanks arturo for advice. i put all the fbo stuff in the main but it still crashed.
so i didn’t work with threads in this project, but i will try it out later what is going wrong.