2 // all needed include files
3 #ifdef OSG_BUILD_ACTIVE
6 #include <OSGSimpleGeometry.h>
7 #include <OSGGLUTWindow.h>
8 #include <OSGSimpleSceneManager.h>
10 #include <OpenSG/OSGGLUT.h>
11 #include <OpenSG/OSGConfig.h>
12 #include <OpenSG/OSGSimpleGeometry.h>
13 #include <OpenSG/OSGGLUTWindow.h>
14 #include <OpenSG/OSGSimpleSceneManager.h>
17 OSG::SimpleSceneManagerRefPtr mgr
;
18 OSG::NodeRecPtr scene
;
20 int setupGLUT( int *argc
, char *argv
[] );
22 OSG::NodeTransitPtr
createScenegraph(void)
24 // the scene must be created here
26 return OSG::NodeTransitPtr();
29 int main(int argc
, char **argv
)
31 OSG::osgInit(argc
,argv
);
34 int winid
= setupGLUT(&argc
, argv
);
35 OSG::GLUTWindowRecPtr gwin
= OSG::GLUTWindow::create();
36 gwin
->setGlutId(winid
);
39 scene
= createScenegraph();
41 mgr
= OSG::SimpleSceneManager::create();
42 mgr
->setWindow(gwin
);
52 void reshape(int w
, int h
)
63 void mouse(int button
, int state
, int x
, int y
)
66 mgr
->mouseButtonRelease(button
, x
, y
);
68 mgr
->mouseButtonPress(button
, x
, y
);
73 void motion(int x
, int y
)
79 int setupGLUT(int *argc
, char *argv
[])
82 glutInitDisplayMode(GLUT_RGB
| GLUT_DEPTH
| GLUT_DOUBLE
);
84 int winid
= glutCreateWindow("OpenSG First Application");
86 glutDisplayFunc(display
);
88 glutMotionFunc(motion
);
89 glutReshapeFunc(reshape
);
90 glutIdleFunc(display
);