How to use GLUT with libdispatch?

做~自己de王妃 提交于 2020-01-04 11:00:21

问题


Both GLUT and libdispatch have their own event-handling loops, which are invoked with functions that never return: glutMainLoop(); and dispatch_main();, respectively.

I've tried:

dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(q, ^{
    glutMainLoop();
});

dispatch_main();

...and the window displays, but does not respond to any events or redraw after the initial call to the function specified with glutDisplayFunc().

How can I get GLUT and libdispatch to play nicely together?


回答1:


You can't. Both of them want to own the message processing loop. And since there's only one such loop, they can't both own it.

If you used FreeGLUT, you could find a way to make that work. But a better alternative would be to just use GLFW.



来源:https://stackoverflow.com/questions/12553563/how-to-use-glut-with-libdispatch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!