1 // all needed include files
2 #ifdef OSG_BUILD_ACTIVE
5 #include <OSGSimpleGeometry.h>
6 #include <OSGGLUTWindow.h>
7 #include <OSGSimpleSceneManager.h>
9 #include <OSGMultiDisplayWindow.h>
10 #include <OSGSceneFileHandler.h>
12 #include <OpenSG/OSGGLUT.h>
13 #include <OpenSG/OSGConfig.h>
14 #include <OpenSG/OSGSimpleGeometry.h>
15 #include <OpenSG/OSGGLUTWindow.h>
16 #include <OpenSG/OSGSimpleSceneManager.h>
18 #include <OpenSG/OSGMultiDisplayWindow.h>
19 #include <OpenSG/OSGSceneFileHandler.h>
22 OSG::SimpleSceneManagerRefPtr mgr
;
23 OSG::NodeRecPtr scene
;
25 int setupGLUT(int *argc
, char *argv
[]);
27 int main(int argc
, char **argv
)
29 OSG::ChangeList::setReadWriteDefault(true);
30 OSG::osgInit(argc
,argv
);
33 setupGLUT(&argc
, argv
);
35 //this time we'll have not a GLUTWindow here, but this one
36 OSG::MultiDisplayWindowRecPtr multiWindow
=
37 OSG::MultiDisplayWindow::create();
39 //set some necessary values
40 // we connect via multicast
41 multiWindow
->setConnectionType("StreamSock");
42 //multiWindow->setServiceAddress("192.168.2.142");
43 // we want to rendering servers...
44 multiWindow
->editMFServers()->push_back("Server1");
45 multiWindow
->editMFServers()->push_back("Server2");
48 scene
= OSG::makeTorus(.5, 2, 16, 16);
50 // and the ssm as always
51 mgr
= OSG::SimpleSceneManager::create();
53 mgr
->setWindow(multiWindow
);
58 multiWindow
->resize(512, 512);
73 //the changelist should be cleared - else things
74 //could be copied multiple times
75 OSG::Thread::getCurrentChangeList()->clear();
77 // to ensure a black navigation window
78 glClear(GL_COLOR_BUFFER_BIT
);
82 void reshape(int w
, int h
)
87 void mouse(int button
, int state
, int x
, int y
)
90 mgr
->mouseButtonRelease(button
, x
, y
);
92 mgr
->mouseButtonPress(button
, x
, y
);
96 void motion(int x
, int y
)
102 int setupGLUT(int *argc
, char *argv
[])
104 glutInit(argc
, argv
);
105 glutInitDisplayMode(GLUT_RGB
| GLUT_DEPTH
| GLUT_DOUBLE
);
107 int winid
= glutCreateWindow("OpenSG");
109 glutReshapeFunc(reshape
);
110 glutDisplayFunc(display
);
111 glutMouseFunc(mouse
);
112 glutMotionFunc(motion
);