From 7a7c64211cb68703fe939d693ec43d31c857a351 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 30 Jan 2009 12:09:06 +0000 Subject: [PATCH] Fixed size of background of frame stats so that it's the correct width of the window --- src/osgViewer/StatsHandler.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index 1fad06b52..1208b2d90 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -275,7 +275,7 @@ void StatsHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer) _camera->setViewport(0, 0, window->getTraits()->width, window->getTraits()->height); _camera->setRenderOrder(osg::Camera::POST_RENDER, 10); - _camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); + _camera->setProjectionMatrix(osg::Matrix::ortho2D(0,window->getTraits()->width,0,window->getTraits()->height)); _camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); _camera->setViewMatrix(osg::Matrix::identity()); @@ -608,8 +608,8 @@ struct StatsGraph : public osg::MatrixTransform _statsGraphGeode(new osg::Geode) { _pos -= osg::Vec3(0, height, 0.1); - this->setMatrix(osg::Matrix::translate(_pos)); - this->addChild(_statsGraphGeode.get()); + setMatrix(osg::Matrix::translate(_pos)); + addChild(_statsGraphGeode.get()); } void addStatGraph(osg::Stats* viewerStats, osg::Stats* stats, const osg::Vec4& color, float max, const std::string& nameBegin, const std::string& nameEnd = "") @@ -629,16 +629,16 @@ protected: Graph(float width, float height, osg::Stats* viewerStats, osg::Stats* stats, const osg::Vec4& color, float max, const std::string& nameBegin, const std::string& nameEnd = "") { - this->setUseDisplayList(false); + setUseDisplayList(false); - this->setVertexArray(new osg::Vec3Array); + setVertexArray(new osg::Vec3Array); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color); - this->setColorArray(colors); - this->setColorBinding(osg::Geometry::BIND_OVERALL); + setColorArray(colors); + setColorBinding(osg::Geometry::BIND_OVERALL); - this->setDrawCallback(new GraphUpdateCallback(width, height, viewerStats, stats, max, nameBegin, nameEnd)); + setDrawCallback(new GraphUpdateCallback(width, height, viewerStats, stats, max, nameBegin, nameEnd)); } }; @@ -1093,10 +1093,11 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) float topOfViewerStats = pos.y() + characterSize; - geode->addDrawable(createBackgroundRectangle( pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0), - _camera->getViewport()->width() - 2 * backgroundMargin, - (3 + 4.5 * cameras.size()) * characterSize + 2 * backgroundMargin, - backgroundColor) ); + geode->addDrawable(createBackgroundRectangle( + pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0), + _camera->getViewport()->width() - 2 * backgroundMargin, + (3 + 4.5 * cameras.size()) * characterSize + 2 * backgroundMargin, + backgroundColor) ); { pos.x() = leftPos;