急
各位大哥,我现在正在做毕业设计,题目是用OpenGL绘制三维图形,但是画的图形显示不出来,没有错误,我估计是视角或者投影变换的问题,求大哥们给小弟看看,一般哪些视角和投影变换的数据能把图形显示出来!谢谢!小弟QQ:43183345,下面这段代码是RenderScene()里的,然后在Ondraw()里调用RenderScene()
glClearColor(1.0,1.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
if(line_display==TRUE)
{
glOrtho(0, 300, 300, 0, -1, 1);
glBegin(GL_LINES);
glColor3f(1.0,0.0,0.0);
glVertex2i(line_sx,line_sy);
glVertex2i(line_ex,line_ey);
glEnd();
}
if(rect_display==TRUE)
{
//glOrtho(0, 300, 300, 0, -1, 1);
//glBegin(GL_LINE_STRIP);
//glColor3f(0.0,1.0,0.0);
glRecti(rect_ltx,rect_lty,rect_rbx,rect_rby);
//glEnd();
}
if(circle_display==TRUE)
{
glBresCircle(circle_x,circle_y,(double)circle_r);
}
if(cube_display==TRUE)
{
auxSolidCube(cube_l);
}
if(cylinder_display==TRUE)
{
glTranslatef(0.0,0.0,-1.0);
auxSolidCylinder(cylinder_r,cylinder_h);
}
if(cone_display==TRUE)
{
glTranslatef(0.0,0.0,-1.0);
auxSolidCone(cone_r,cone_h);
}
if(sphere_display==TRUE)
{
glTranslatef(0.0,0.0,-1.0);
auxSolidSphere(sphere_r);
}
glFlush();
::SwapBuffers(m_pDC->GetSafeHdc()); //交互缓冲区
下面这些是OnSize()里的代码:
glViewport(0,0,(GLsizei)cx,(GLsizei)cy);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
if (cx <= cy)
glOrtho (-1.5, 1.5, -1.5*(GLfloat)cy/(GLfloat)cx,
1.5*(GLfloat)cy/(GLfloat)cx, -10.0, 10.0);
else
glOrtho (-1.5*(GLfloat)cx/(GLfloat)cy,
1.5*(GLfloat)cx/(GLfloat)cy, -1.5, 1.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();