Why glOrtho() works under Mac but gluOrtho2D() doesn't?

巧了我就是萌 提交于 2020-01-14 13:48:08

问题


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);

and after changing it to:

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

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


回答1:


OK I think I get the answer.

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.

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



来源:https://stackoverflow.com/questions/12315126/why-glortho-works-under-mac-but-gluortho2d-doesnt

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