我在阅读the documentation for glOrtho而不理解它。glOrtho(-1,1,-1,1,-1,1)完成什么?
我正在看这个调整大小代码的2D绘图,并没有得到为什么一些索引是积极的和一些消极的。该图应该保持平坦,所以我不知道它是否应该做什么:
void reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
//left, right, bottom, top, nearval, farval
glMatrixMode(GL_MODELVIEW);
}
什么是glOrtho(0.0f,windowWidth,windowHeight,0.0f,0.0f,1.0f);完成?世界的限制将是windowWidth和WindowHeight,对吧? – andandandand 2010-10-31 14:44:06
正确,尽管您必须小心使用z = 0进行绘制,因为它将位于z域的边缘(任何与z <0 or z> 1将被隐藏)。如果您打算在z = 0处绘制图画,那么出于安全考虑,最好将范围设置为(-1,+1)。 – 2010-10-31 15:30:25