问题
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