Hi Robert, Responding this time with a reproducible example. Attached is a minimal osgtext.cpp that attempts to demonstrate a problem with text scaling.
There is 1 osgText::Text in screen coordinates. I would expect the text to be the same size regardless of window dimensions. For most larger and square-ish dimensions, this is mostly true. But it breaks down with smaller window sizes. If you run the attached "osgtext --size1" you'll see "normal" text. "osgtext --size2" gives vastly different screen text size with a short window. Conversely, "osgtext --size3" gives a pretty similar text size with a tall/skinny window. Is this intentional? Note that the same behavior can be seen by observing the "text5" in osgtext, if you also make the host window resizeable (e.g. using WindowSizeHandler and hitting 'f' key) I've tried a few different options to get a consistent size across the three window sizes (normal, skinny, short) to no avail. Thanks for your help. - Dan -----Original Message----- From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Wednesday, May 02, 2018 4:23 AM To: OpenSceneGraph Users Subject: [osg-users] OpenSceneGraph-3.6.1 release candidate 2 tagged Hi All, I have tagged the second 3.6.1 release candidate. I have merged a PR that removed so un-implemented functions in osgParticle, this technically changes the ABI for osgParticle so I've bumped the SO version for 3.6.1-rc2. The rest of the changes are fixes. https://github.com/openscenegraph/OpenSceneGraph/tree/OpenSceneGraph-3.6.1-rc2 I'm ready to tag 3.6.1, all need from the community is testing and feedback on whether things are working on all the main platforms. Let us know of success or failures here on this thread. Cheers, Robert.
/* OpenSceneGraph example, osgtext. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include <osgDB/ReadFile> #include <osgGA/StateSetManipulator> #include <osgViewer/Viewer> #include <osgViewer/ViewerEventHandlers> #include <osgViewer/config/SingleWindow> #include <osg/Geode> #include <osg/Camera> #include <osgText/Font> #include <osgText/Text> // create text which sits in 3D space such as would be inserted into a normal model osg::Group* create3DText(const osg::Vec3& center) { osg::Geode* geode = new osg::Geode; osgText::Text* text5 = new osgText::Text; text5->setFont("fonts/times.ttf"); text5->setCharacterSize(32.0f); // medium text5->setPosition(center - osg::Vec3(0.0, 0.0, 0.2)); text5->setAxisAlignment(osgText::Text::SCREEN); text5->setCharacterSizeMode(osgText::Text::SCREEN_COORDS); text5->setDrawMode(osgText::Text::TEXT | osgText::Text::BOUNDINGBOX); text5->setText("Resize skinny vs tall and see font size difference"); geode->addDrawable(text5); osg::Group* rootNode = new osg::Group; rootNode->addChild(geode); return rootNode; } int main(int argc, char** argv) { osg::ArgumentParser arguments(&argc, argv); // construct the viewer. osgViewer::Viewer viewer(arguments); viewer.setUpViewInWindow(100, 100, 800, 600); // prepare scene. osg::Vec3 center(0.0f, 0.0f, 0.0f); // make sure the root node is group so we can add extra nodes to it. osg::Group* group = new osg::Group; group->addChild(create3DText(center)); // set the scene to render viewer.setSceneData(group); viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet())); viewer.addEventHandler(new osgViewer::StatsHandler()); viewer.addEventHandler(new osgViewer::WindowSizeHandler()); int width = 800; int height = 600; if (arguments.read("--size1")) ; // noop else if (arguments.read("--size2")) height = 100; else if (arguments.read("--size3")) width = 100; viewer.setUpViewInWindow(100, 100, width, height); viewer.run(); return 0; }
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org