|
楼主 |
发表于 2008-9-24 09:09:04
|
显示全部楼层
经过测试发现改用透视投影是可以的.
一个最简单的程序- osgViewer::Viewer viewer;
- viewer.setSceneData( osgDB::readNodeFile("cow.osg"));
- viewer.getCamera()->setProjectionMatrixAsPerspective( 90, 1, 10, 100. ); //OK
- //viewer.getCamera()->setProjectionMatrixAsFrustum(-10, 10, -10, 10, 10, 100); //OK
- //viewer.getCamera()->setProjectionMatrixAsOrtho(-10,10,-10,10,-10,10); //not OK
- //viewer.getCamera()->setProjectionMatrixAsOrtho2D(-10, 10, -10, 10); //not OK
- viewer.getCamera()->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
- viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3(0.0f,10.0f,0.0f), osg::Vec3(0.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f));
- //viewer.run();
- while (!viewer.done())
- {
- viewer.frame();
- }
复制代码 用透视投影可以正确显示,用正交投影显示不出任何东西.请问原因是什么?怎么解决?
谢谢!
附件里是测试程序 |
|