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

Revision 9319, 1.2 kB (checked in by robert, 5 years ago)

Intoduce new osgWidget::PdfReader? and osgWidget::VncClient? front ends to osgWidget,
with new pdf plugin and updated vnc plugin that now support these front ends.

Updated osgpdf and osgvnc examples to new these new interfaces.

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