Hi everyone, I am working for a simple gl program. The program create a thread to watch a directory, if one shader changed, the program will load it then render scene with it. In my current implemention the process owns 2 threads, so the gl thread must to wait until the others thread set event, then it will render scene again, so the scene seems like dead, the overlapped part can’t be refresh. So what can I do ?
Render in loop… at beginning of loop check is there any signal from directory watcher thread. If you detect signal, reload scene.
Or post a custom window message
I have a question, and I dont open another thread. But do all Opengl’s calls must be in main thread? Can I use the second thread for all Opengl’s calls? The main thread runs also the dispatch of window’s messages, the second not.
Thanks for all answers.
All gl calls MUST be from thread which have wglMakeCurrent(dc,rc) call.
It is perfectly legal to have main thread with Windows message loop and another thread which create gl context make it current and call gl functions. In case of resize main window you “notify” render thread about that and in next render loop update your viewport.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.