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

来源:互联网 发布:手机哼歌识曲的软件 编辑:程序博客网 时间:2024/05/01 06:55

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

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

1.透视投影

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


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



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



0 0
原创粉丝点击