changed: gcc8 base update
[opensg.git] / Source / Contrib / ComplexSceneManager / appCSM.cpp
blob16049bc8c003245cf4fd7e2ea23d8f39d35f1616
2 #include "OSGComplexSceneManager.h"
3 #include "OSGOSGSceneFileType.h"
4 #include "OSGBaseInitFunctions.h"
5 #include "OSGGLU.h"
7 void dumpGLError(GLenum glError, const GLubyte *glErrorString)
9 fprintf(stderr, "Custom error dump\n");
10 fprintf(stderr, "-----------------\n");
12 #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
13 switch(glError)
15 case GL_STACK_OVERFLOW:
16 case GL_STACK_UNDERFLOW:
18 GLint iMatMode;
19 GLint iMoViMatInfo[2];
20 GLint iProjMatInfo[2];
21 GLint iTexMatInfo [2];
23 glGetIntegerv(GL_MATRIX_MODE, &iMatMode);
25 glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &(iMoViMatInfo[0]));
26 glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &(iMoViMatInfo[1]));
28 glGetIntegerv(GL_PROJECTION_STACK_DEPTH, &(iProjMatInfo[0]));
29 glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &(iProjMatInfo[1]));
31 glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &(iTexMatInfo[0]));
32 glGetIntegerv(GL_MAX_TEXTURE_STACK_DEPTH, &(iTexMatInfo[1]));
34 fprintf(stderr, " MatrixMode 0x%04x\n", iMatMode);
36 fprintf(stderr, " ModelViewStack %d %d\n",
37 iMoViMatInfo[0],
38 iMoViMatInfo[1]);
40 fprintf(stderr, " ProjectionStack %d %d\n",
41 iProjMatInfo[0],
42 iProjMatInfo[1]);
44 fprintf(stderr, " TextureStack %d %d\n",
45 iTexMatInfo[0],
46 iTexMatInfo[1]);
49 #endif
52 int init(int argc, char **argv)
54 #ifdef WIN32
55 OSG::preloadSharedObject("OSGImageFileIO");
56 #endif
58 OSG::ChangeList::setReadWriteDefault(true);
60 OSG::osgInit(argc,argv);
62 OSG::GLErrorCallback = dumpGLError;
64 // Assume dir is given
65 if(argc == 2)
67 // fprintf(stderr, "start from dir\n");
69 std::string szParamFilename = argv[1];
71 if(szParamFilename[szParamFilename.length() - 1] == '/')
73 szParamFilename += "params.csm";
75 else
77 szParamFilename += "/params.csm";
80 fprintf(stderr, "Trying to start from : %s\n", szParamFilename.c_str());
82 OSG::ComplexSceneManager::startFrom(szParamFilename);
84 else if(argc > 2)
86 fprintf(stderr, "start from arg\n");
88 OSG::ComplexSceneManager::the()->startFrom(argc,
89 argv);
91 else
93 OSG::OSGSceneFileType::the().readContainer(
94 "Source/Contrib/ComplexSceneManager/data/system-native.osg");
96 fprintf(stderr, "Got %p\n",
97 static_cast<void *>(OSG::ComplexSceneManager::the()));
99 const char *argvTmp[] =
101 "testCSM",
102 "Source/Contrib/ComplexSceneManager/data/system-native.osg",
103 "--data",
104 "TestData/tie.wrl",
105 "--global",
106 "Source/Contrib/ComplexSceneManager/data/simple_mouse.osg"
109 int argcTmp = 6;
111 OSG::ComplexSceneManager::the()->startFrom(
112 argcTmp,
113 const_cast<char **>(argvTmp));
115 OSG::ComplexSceneManager::the()->run();
118 // OSG::osgExit();
120 return 0;
123 int main (int argc, char **argv)
125 init(argc, argv);
127 return 0;