|
Revision 5846, 1.3 kB
(checked in by robert, 6 years ago)
|
|
Unified the osg::GraphicsThread::Operation and osg::GraphicsContext::Operation classes
as osg::GraphicsOperation?. Unpdated parts of OSG depending upon these.
Added a virtaul bool valid() method to osg::GraphicsContext? to allow apps to
test whether a valid graphis context has been created or not.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | #include <osgDB/ReadFile> |
|---|
| 8 | #include <osgViewer/Viewer> |
|---|
| 9 | #include <osgGA/TrackballManipulator> |
|---|
| 10 | #include <iostream> |
|---|
| 11 | |
|---|
| 12 | int main( int argc, char **argv ) |
|---|
| 13 | { |
|---|
| 14 | if (argc<2) |
|---|
| 15 | { |
|---|
| 16 | std::cout << argv[0] <<": requires filename argument." << std::endl; |
|---|
| 17 | return 1; |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(2); |
|---|
| 22 | osg::Referenced::setThreadSafeReferenceCounting(true); |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(argv[1]); |
|---|
| 26 | if (!loadedModel) |
|---|
| 27 | { |
|---|
| 28 | std::cout << argv[0] <<": No data loaded." << std::endl; |
|---|
| 29 | return 1; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | osgViewer::Viewer viewer; |
|---|
| 33 | |
|---|
| 34 | viewer.setSceneData(loadedModel.get()); |
|---|
| 35 | |
|---|
| 36 | viewer.setCameraManipulator(new osgGA::TrackballManipulator()); |
|---|
| 37 | viewer.getCamera()->setClearColor(osg::Vec4f(0.6f,0.6f,0.8f,1.0f)); |
|---|
| 38 | |
|---|
| 39 | viewer.setUpViewAcrossAllScreens(); |
|---|
| 40 | viewer.realize(); |
|---|
| 41 | |
|---|
| 42 | bool limitNumberOfFrames = false; |
|---|
| 43 | unsigned int numFrames = 0; |
|---|
| 44 | unsigned int maxFrames = 100; |
|---|
| 45 | |
|---|
| 46 | while(!viewer.done() && !(limitNumberOfFrames && numFrames>=maxFrames)) |
|---|
| 47 | { |
|---|
| 48 | viewer.frame(); |
|---|
| 49 | ++numFrames; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | return 0; |
|---|
| 53 | } |
|---|