root/OpenSceneGraph/trunk/examples/osgpdf/osgpdf.cpp @ 14098

Revision 12292, 1.1 kB (checked in by robert, 3 years ago)

Ran svn propset -R svn:eol-style native . on the OpenSceneGraph

  • Property svn:eol-style set to native
Line 
1#include <osgViewer/Viewer>
2#include <osgViewer/ViewerEventHandlers>
3
4#include <osgWidget/PdfReader>
5
6int main(int argc,char** argv)
7{
8    osg::ArgumentParser arguments(&argc, argv);
9    osgViewer::Viewer viewer(arguments);
10
11    osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
12                                   osg::Vec3(1.0f,0.0f,0.0f),
13                                   osg::Vec3(0.0f,0.0f,1.0f),
14                                   osg::Vec4(1.0f,1.0f,1.0f,1.0f),
15                                   osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
16
17    osg::ref_ptr<osg::Group> group = new osg::Group;
18
19    for(int i=1; i<arguments.argc(); ++i)
20    {
21        if (!arguments.isOption(i))
22        {
23            osg::ref_ptr<osgWidget::PdfReader> pdfReader = new osgWidget::PdfReader;
24            if (pdfReader->open(arguments[i], hints))
25            {           
26                group->addChild(pdfReader.get());
27               
28                hints.position.x() += 1.1f;
29            }
30        }
31    }
32
33    viewer.setSceneData(group.get());
34
35    viewer.addEventHandler(new osgViewer::StatsHandler);
36
37    return viewer.run();
38}
Note: See TracBrowser for help on using the browser.