为什么glOrtho()在Mac上可以运行,而gluOrtho2D()不能在Mac上运行? [英] Why glOrtho() works under Mac but gluOrtho2D() doesn't?

查看:137
本文介绍了为什么glOrtho()在Mac上可以运行,而gluOrtho2D()不能在Mac上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我发布了这个问题(我不知道打开一个新线程是否合适……但是,当我从这篇文章中得到答案时,我将关闭该线程):QGLWidget在Mac OS X Lion上无法正常工作.

Several days ago I posted this question(I don't know if it's proper to open a new thread... however when I get the answer from this post I will close that one): QGLWidget not working correctly under Mac OS X Lion .

我在线上获取了一些示例代码,将它们与我的代码进行了比较,并确认问题出在以下方面:

I grabbed some example code online, compared them with mine, and confirmed the problem is raised by:

gluOrtho2D(0, w, 0, h);

并将其更改为:

glOrtho(0, w, 0, h, -1, 1);

并删除了glu作为依赖项,我的程序正常工作.为什么?有什么区别?

and removed glu as dependency, my program worked. why? what's the difference?

推荐答案

好的,我想我已经找到答案了.

OK I think I get the answer.

问题是我链接了两个版本的OpenGL.苹果有自己的GL实施AGL,Qt将链接到该实施;但是我不知道,所以我也将安装在/opt/local下的glu链接到该程序.我猜测,Mac Ports引入了该版本以编译X11程序.

The problem is I was linking two versions of OpenGL; Apple has its own GL implementation, AGL, which Qt will link to; but I didn't know that so I linked glu installed under /opt/local to the program as well. I guess that version is introduced by Mac Ports to compile X11 programs.

无论如何,因为我删除了GLU的依赖关系,所以唯一的链接实现是AGL;因此它按预期工作.

Anyway, because I removed dependency of GLU, the only linked implementation is AGL; so it worked as expected.

这篇关于为什么glOrtho()在Mac上可以运行,而gluOrtho2D()不能在Mac上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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