如何在libdispatch中使用GLUT? [英] How to use GLUT with libdispatch?

查看:101
本文介绍了如何在libdispatch中使用GLUT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GLUT和libdispatch都有它们自己的事件处理循环,分别用永不返回的函数分别调用:glutMainLoop();dispatch_main();.

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

我尝试过:

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

dispatch_main();

...,并显示窗口,但在首次调用glutDisplayFunc()指定的函数后,窗口不响应任何事件或重新绘制.

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

我如何才能使GLUT和libdispatch一起很好地玩耍?

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

推荐答案

您不能.他们两个都希望拥有消息处理循环.而且由于只有这样一个循环,所以他们不能都拥有它.

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.

如果您使用了 FreeGLUT ,则可以找到一种使之起作用的方法.但是更好的选择是只使用 GLFW .

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

这篇关于如何在libdispatch中使用GLUT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆