opengl 投影 glOrtho gluPerspective gluLookAt
来源:互联网 发布:复杂网络可控性 编辑:程序博客网 时间:2024/05/02 05:00
正投影和透视投影是OPENGL里最基本,而且最重要的内容.
下图分别是正投影和透视投影的运行效果图,运行的是两个大小,外貌完全相同的组合矩型框体.
但是视觉效果上却非常不一样,这正是正投影和透视投影的区别.
这由于正投影的逻辑宽度在前,后,顶,底,左,右都是相等的. 正投影往往适用与CAD, 文本,建筑绘图,2D游戏等用3D来描绘2D的处理,关键代码:
void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val);
//这里注意是 GL 的函数, glOrtho更像是设置平面的坐标系统
//left是左坐标,right是右坐标,bottom是底坐标,top是顶坐标,near_val是近可视,far_val是远可视
透视投影则执行透视除法,对距离观察者较远的物体矩阵进行缩短和收缩.在投影到屏幕后,可视区域后端和前端的可视宽度不同.所以透视投影更适用于3D场景.例如3D游戏,关键代码:
void gluPerspective(double fovy, double aspect, double zNear, double zFar);
//这里注意是 GLU 的函数,gluPerspective像是设置摄像机,也像人的眼睛
//fovy为可视角度,aspect宽高比例,zNear近可视,zFar是远可视
一般来说透视投影会配合
glu.gluLookAt(0.0, 0.0, 0.0,
0.0, 0.0, 1.0,
0.0, 1.0, 0.0);
使用,原形为
public void gluLookAt(double eyeX, double eyeY, double eyeZ, //表示眼睛的坐标
double centerX, double centerY, double centerZ, //眼睛看向哪个点
double upX, double upY, double upZ) ; //角度宽度,一般为0,1,0
在不使用gluLookAt的情况下,系统默认眼睛(摄像机)在原点,也就是(0,0,0)点,向着负Z轴方向看,那么眼睛看向的反方向就是正Z轴方向
简单比喻就是gluPerspective设置眼睛的性能,gluLookAt设置眼睛的位置和视觉方向.
- opengl 投影 glOrtho gluPerspective gluLookAt
- opengl 投影 glOrtho gluPerspective gluLookAt 转载不同作者的理解
- 【读书笔记】gluLookAt和glOrtho,gluPerspective
- glHint、gluLookAt、glOrtho、gluPerspective、glViewport
- gluLookAt、glViewport()、glOrtho和gluPerspective参数分析
- OpenGL中投影函数glOrtho()、glFrustum()以及gluPerspective()以及函数的用法
- OpenGL透视投影gluPerspective
- OpenGL透视投影gluPerspective
- OpenGL透视投影gluPerspective
- OpenGL透视投影gluPerspective
- (5)gluLookAt、glViewport()、glOrtho和gluPerspective参数分析
- OpenGL: gluPerspective和gluLookAt的关系
- OpenGL: gluPerspective和gluLookAt的关系
- openGL初学笔记 - gluPerspective 与 gluLookAt
- OpenGL的gluLookAt和gluPerspective详解
- opengl中gluPerspective和gluLookAt的关系
- 【OpenGL】gluLookAt()和gluPerspective()的区别
- OpenGL: gluPerspective和gluLookAt的关系
- select table_name from all_tables where owner='ofbiz';
- 《GOF设计模式》—中介者 (MEDIATOR)—Delphi源码示例:Smalltalk/V的应用结构
- NOPCommerce(1)
- ubuntu 10.10 + VirtualBox 4 安装Mac OS X 10.6 雪豹操作系统图文详解
- undefined reference to ‘raise’
- opengl 投影 glOrtho gluPerspective gluLookAt
- android3G连接状态判断
- 关于malloc和free的疑惑...
- 在谷歌搜索趋势图,Google Insights for Search http://www.google.com/trends
- ORACLE
- 简单工厂模式
- 测试音视频合并中存在的问题或现象(thinkvd开发日志)
- 2011.2.25 看java-类与对象
- C语言关于头文件的使用