gluPerspective函数

gluPerspective

  NAME(函数名称)

  gluPerspective -- set up a perspective projection matrix (设置透视投影矩阵)

  C SPECIFICATION(C语言实现示例)

  void gluPerspective(

  GLdouble fovy, //角度

  GLdouble aspect,//视景体的宽高比

  GLdouble zNear,//沿z轴方向的两裁面之间的距离的近处

  GLdouble zFar //沿z轴方向的两裁面之间的距离的远处

  )

  PARAMETERS(参数含义)

  fovy

  Specifies the field of view angle, in degrees, in the y direction.

  指定视景体的视野的角度,以度数为单位,y轴的上下方向

  aspect

  Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).

  指定你的视景体的宽高比(x 平面上)

  zNear

  Specifies the distance from the viewer to the near clipping plane (always positive).

  指定观察者到视景体的最近的裁剪面的距离(必须为正数)

  zFar

  Specifies the distance from the viewer to the far clipping plane (always positive).

  与上面的参数相反,不再啰嗦的翻译了(这个参数也必须是正数)

  DESCRIPTION(说明)

  gluPerspective specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in gluPerspective should match the aspect ratio of the associated viewport. For example, aspect = 2.0 means the viewer's angle of view is twice as wide in x as it is in y. If the viewport is twice as wide as it is tall, it displays the image without distortion.

  gluPerspective这个函数指定了观察的视景体(frustum为锥台的意思,通常译为视景体)在世界坐标系中的具体大小,一般而言,其中的参数aspect应该与窗口的宽高比大小相同。比如说,aspect=2.0表示在观察者的角度中物体的宽度是高度的两倍,在视口中宽度也是高度的两倍,这样显示出的物体才不会被扭曲。

  The matrix generated by gluPerspective is multipled by the current matrix, just as if glMultMatrix were called with the generated matrix. To load the perspective matrix onto the current matrix stack instead, precede the call to gluPerspective with a call to glLoadIdentity.

  由gluPerspective产生的矩阵是与当前矩阵与指定的矩阵相乘得到的,就好像是glMatrix()调用被产生的矩阵一样。为把吧透视矩阵替代当前矩阵压栈,在调用gluPerspective之前要先调用glLoadidentity()这个函数.

  补充,这段话的意思就是说(个人理解),这个gluPerspective的实现是通过将当前矩阵与你通过这个函数指定的参数而建立的矩阵相乘来实现的,而在OpenGL中,矩阵的相乘都是连乘的,也就是说,你调用这个函数会与其他的变化矩阵的函数效果相叠加从而影响原矩阵(当然有时候确实需要这样做),所以,在调用这个函数之前,通常需要先调用glLoadidentity来把当前矩阵单位化,从而使各种变换效果不会叠加,比如旋转就之旋转,透视就只透视,通过调用glLoadidentity就不会既旋转有透视了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值