Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void render_thread() {
- glfwMakeContextCurrent(win);
- while( !glfwWindowShouldClose(win) ) {
- sleep(10); // emulate heavy rendering, to be sure that main loop stops event processing during this sleep
- glfwSetWindowTitle(win, "some title"); // posts message? to window queue to update title
- }
- glfwMakeContextCurrent(nullptr);
- }
- void main_thread() {
- set_thread_priority(highest); // to be sure this is first priority in OS sheduler, compared to render thread
- win = glfwCreateWindow(...);
- std::thread rt(&render_thread);
- while (!glfwWindowShouldClose(_glWindow))
- glfwWaitEvents(); // could put thread to sleep
- rt.join();
- }
Add Comment
Please, Sign In to add comment