投影变换的最终目的是定义一个视景体,视景体有两个用途,首先,视景体是决定一个物体是如何映射到屏幕的,

其次,视景体定义了哪些物体(或物体的一部分)被裁剪到最终的图像之外

1.透视投影

void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);


《高效学习OpenGL》之 投影变换 glFrustum(),gluPerspective(),glOrtho(),gluOrtho2D()_gluOrtho2D

void APIENTRY gluPerspective (
GLdouble fovy,
GLdouble aspect,
GLdouble zNear,
GLdouble zFar);
//fovy:角度 aspect:纵横比 zNear:观测点与近侧裁剪截面的距离 zFar:与远侧裁剪截面的距离
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);


《高效学习OpenGL》之 投影变换 glFrustum(),gluPerspective(),glOrtho(),gluOrtho2D()_gluOrtho2D_02


2.正射投影

void APIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);


void APIENTRY gluOrtho2D (
GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top);


《高效学习OpenGL》之 投影变换 glFrustum(),gluPerspective(),glOrtho(),gluOrtho2D()_opengl_03