|
发表于 2009-10-30 15:11:46
|
显示全部楼层
下面一段代码,您判断一下四方形应当占据屏幕的多达范围?- osg::Camera* createHUD( double l, double r, double b, double t )
- {
- osg::ref_ptr<osg::Camera> camera = new osg::Camera;
- camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
- camera->setViewMatrix( osg::Matrix::identity() );
- camera->setProjectionMatrix( osg::Matrix:rtho2D(l, r, b, t) );
- camera->setClearMask( GL_DEPTH_BUFFER_BIT );
- camera->setRenderOrder( osg::Camera:OST_RENDER );
- camera->setAllowEventFocus( false );
- camera->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
- return camera.release();
- }
- int main(...)
- {
- ...
- osg::Geode* geode = new osg::Geode;
- geode->addDrawable( osg::createTexturedQuadGeometry(
- osg::Vec3(-320.0f,-240.0f,0.0f), osg::Vec3(640.0f,0.0f,0.0f), osg::Vec3(0.0f,480f,0.0f)) );
- osg::Camera* hud = createHUD( -640.0f, 640.0f, -480.0f, 480.0f );
- hud->addChild( geode );
- ...
- }
复制代码 实际情况是正好占据了屏幕中央四分之一的区域,并且不会受到鼠标和键盘事件的影响。您觉得呢?请为我说明一下理由好吗?谢谢。
希望对您的学习理解有帮助。 |
|