|
|

楼主 |
发表于 2007-3-23 20:33:00
|
显示全部楼层
Re: 窗口变化后,场景变暗,为什么?
void CTarecView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
int w=cx; int h=cy;
if(h == 0)
h = 1;
glViewport(0,0,w,h); //定义显示范围
glMatrixMode(GL_PROJECTION); //启动透视矩阵
glLoadIdentity(); //初始化
//视场调节
gluPerspective
(45.0f, // Field-of-view angle
(GLfloat)w/(GLfloat)h, // Aspect ratio of viewing volume
0.1f, // Distance to near clipping plane
3000.0f); // Distance to far clipping plane
glMatrixMode(GL_MODELVIEW); // 设置当前矩阵为模型视图矩阵
glLoadIdentity(); // 重置当前指定的矩阵为单位矩阵
}
这是我的OnSize(UINT nType, int cx, int cy)函数全部代码,好像没有你说的问题啊 |
|