osg::Camera* createInvertedYOrthoCamera(float width, float height) { osg::Camera* camera = createOrthoCamera(width, height); camera->setProjectionMatrix(createInvertedYOrthoProjectionMatrix(width, height)); return camera; }
bool ResizeHandler::handle( const osgGA::GUIEventAdapter& gea, osgGA::GUIActionAdapter& gaa, osg::Object* obj, osg::NodeVisitor* nv ) { osgGA::GUIEventAdapter::EventType ev = gea.getEventType(); if(ev != osgGA::GUIEventAdapter::RESIZE) return false; osg::Matrix::value_type w = gea.getWindowWidth(); osg::Matrix::value_type h = gea.getWindowHeight(); if(_wm->isInvertedY()) _camera->setProjectionMatrix( createInvertedYOrthoProjectionMatrix(w, h) ); else _camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0f, w, 0.0f, h)); _wm->setSize(w, h); _wm->resizeAllWindows(); return true; }