设为首页 加入收藏

TOP

openGL的project matrix 和 model matrix
2014-11-24 08:29:36 来源: 作者: 【 】 浏览:1
Tags:openGL project matrix model

最近和juanL两个人调openGL,现在才把一些东西搞清楚


project matrix 相当于是内参,自己设置的一些东西,可以通过gluperspective之类的函数设置


model matrix 相当于外参, 就是R和T。


一般情况下,程序都至少会调用设置project matrix一次,如我们通常在reshape回调函数里设置gluperspective函数(因为不管怎么样所有的回调函数都得至少跑一次,如下面的resizeGL函数,就是通过调用这个函数让我们设置内参数。)


就是因为如果窗口发生变化的话,我们的project matrix得重新设置,一般都是


void GLWidget::resizeGL(int width, int height)
{
if ( height == 0 )
{
height = 1;
}
glViewport( 0, 0, (GLint)width, (GLint)height );
glMatrixMode( GL_PROJECTION ); // 开始设置project matrix
glLoadIdentity(); // 清楚影响
gluPerspective( 45.0, (GLfloat)width/(GLfloat)height, 0.1, 100.0 ); // 设置project matrix
glMatrixMode( GL_MODELVIEW ); // 开始设置model matrix
glLoadIdentity();
}



可以多看看红宝书。


整个openGL就是一个起到一个摄像机的作用。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Python 实现的“冒泡排序” 下一篇Linux下i2c与时钟芯片PCF8563的通..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)