20,741
edits
| Line 176: | Line 176: | ||
== CanvasPDF == | == CanvasPDF == | ||
Checking the examples in the osg source tree, the demo rendering a PDF to a osg::Node is fairly compelling and extremely compact, requiring only ~15 lines of code {{OSG example|example=osgpdf}}: | Checking the examples in the osg source tree, the demo rendering a PDF to a osg::Node is fairly compelling and extremely compact, requiring only ~15 lines of code {{OSG example|example=osgpdf}}: | ||
| Line 190: | Line 188: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[File:Osgpdf-showing-getstart.png|right|thumb|Screenshot showing the unmodified osgpdf example which loads a pdf file, renders it to a surface and adds it to the osgviewer scene]] | |||
So all that is needed is including the osgWidget/PdfReader header and editing the top-level CMakeListst.txt file in sgsrc/fgsrc to ensure that osgWidget is added as a required library in the find_package() call: | So all that is needed is including the osgWidget/PdfReader header and editing the top-level CMakeListst.txt file in sgsrc/fgsrc to ensure that osgWidget is added as a required library in the find_package() call: | ||
| Line 210: | Line 211: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Next, we need to edit the constructor accordingly, and make sure that the osg::Node is added to the _transform member of the CanvasElement we are creating. | |||
To turn this into a proper element, we can next open the header itself and check what methods are available, so that these can be exposed via Canvas properties | To turn this into a proper element, we can next open the header itself and check what methods are available, so that these can be exposed via Canvas properties | ||