具体的可以请看:GL学习笔记(2) - 终于搞明白gluPerspective和gluLookAt的关系了
函数原型
gluLookAt(GLdoble eyex,GLdouble eyey,GLdouble eyez,GLdouble centerx,GLdouble centery,GLdouble centerz,GLdouble upx,GLdouble upy,GLdouble upz);
gluPerspective(GLdouble fovy,GLdouble aspect,GLdouble zNear,GLdouble zFar)
我的理解:
拿拍照来看:
一:gluPerspective相当于调整照相机与景物的距离
1. 如果想把物体拍全,把景物都拍进去,就要远离物体(即调整zNear的值)
二:gluLookAt相当于调整相机的焦距
1. 如果想拍全景物,就要把焦距调小,等于是减小放大倍数(即调整center与eye之间的距离)
2. 如果想拍倒立的景物,只要把相机反过来就行(即调整up的向量的方向)
总结:所以这个方法的调整是相互作用的,要结合起来调整。另外,如果想模拟人眼,那视角就要小于45度,只有这样成的像,才不会变形。
分享到:
相关推荐
http://blog.csdn.net/whucv/article/details/8150537 ArchieOpenGL基础教程搭建OpenGL框架(SDI), 三维显示 gluLookAt gluperspective。学习使用gluPerspective和gluLookAt函数。
#include "GL/GLU.H" #include "GL/GL.H" #include "GL/GLAUX.H" glWidget.obj:-1: error: LNK2019: 无法解析的外部符号 gluPerspective,该符号在...-1: error: LNK2019: 无法解析的外部符号 gluLookAt,该符号在函数
SBE306B-作业3-摄像机移动 在以下人员的监督下: ( 和工程 ... gluPerspective ( 65.0 , (GLfloat)1024 / (GLfloat)869, 1.0, 60.0); 并在显示函数的gluLookAt添加gluLookAt函数 全局变量 double eye[] = { 0
自己封装的glulookat,gluperspective and gluOrtho,可以在任何平台使用
使用OpenGL读取3DS文件的示例代码。 演示说明了3DS文件的结构、三维控件中视线、旋转设置,以及简单的动画...如果读取结果是黑屏,往往是视角和视场设置错误,可以查看三维数据的位置,更改gluLookAt和gluPerspective。
例如,不能使用以下在Web教程中常用的函数:gluLookAt(),gluOrtho2D(),gluPerspective(),gluPickMatrix(),gluProject(),gluUnProject(),glm :: lookAt() ,glm :: ortho(),glm ::透视(),...
gluPerspective gluLookAt gluProject gluUnProject 多重映射 ------------------------------ gluBuild1DMipmaps gluBuild2DMipmaps gluScaleImage 查询函数 ----------------------------- ...
gluPerspective(45.0f,1.3333f,0.1f,1000.0f); glMatrixMode(GL_MODELVIEW); // Set The Blending Function For Translucency glBlendFunc(GL_SRC_ALPHA,GL_ONE); glEnable(GL_BLEND);
Void gluPerspective(GLdouble fovy,GLdouble aspect, GLdouble near, GLdouble far) 函数作用: 创建一个表示对称投影视图矩阵,并把它与当前矩阵相乘。Fovy是yz平面上视野的角度,它的值必须为[0.0,180.0]。aspect...
gluPerspective(45, fAspect, 1.0, 600.0);//设置透视投影矩阵 glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void Satellite() //增加卫星 { for (int n=0; n[i]; n++) { glPushMatrix(); glRotatef(30.0f+6*n...
gluPerspective(40.0,aspect,5.0,1000.0); } void CMFCFrame1View::OnDraw(CDC* pDC) { CMFCFrame1Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here CPaintDC ...
gluLookAt(viewer[0],viewer[1],viewer[2],viewer[3],viewer[4],-5,0,1,0); //摄像机x,摄像机y,摄像机z, 目标点x,目标点y,目标点z, 摄像机顶朝向x,摄像机顶朝向y,摄像机顶朝向z // 获得系统时间使太阳系有动态...
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 30.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, -3.6); } void keyboard (unsigned char key, int x, int y) { switch ...
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,1000.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int ...
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,1000.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int InitGL(GLvoid) // ...