为什么要glMatrixMode(GL_PROJECTION)图象才能显示出来!(但是很难看)(50分在线)
OnWMSize
if (m_nheight==0) // Prevent A Divide By Zero By
{
m_nheight=1; // Making Height Equal One
}
glViewport(0,0,m_nwidth,m_nheight); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)m_nwidth/(GLfloat) m_nheight,0.1f,400.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity();
if (m_nwidth > m_nheight)
m_naspect = m_nwidth;
else
m_naspect = m_nheight;
Render
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//glPushMatrix();
//glMatrixMode(GL_PROJECTION);//这句删掉就什么都不画出来,一片黑
//加上去的话画出来的东西好象不是立体的.十分难看!!!
auxSolidTeapot(1.0);
//glPopMatrix();
glFlush();
glLoadIdentity();
SwapBuffers(m_hDC);
初学者,分不够再加!在线!
问题点数:0、回复次数:2Top
1 楼jiangyouliang(归来去兮)回复于 2003-04-04 20:39:06 得分 0
你没有赋予teapot材质 也没有在场景中加入照明 肯定难看
Top
2 楼starcbh(信仰)回复于 2003-04-04 20:51:11 得分 0
那么//glPushMatrix();
//glMatrixMode(GL_PROJECTION);
//glPopMatrix();
是正确的了?
它的意思是什么?
这个说完后马上给分!谢谢
Top




