2 #include "OSGComplexSceneManager.h"
3 #include "OSGOSGSceneFileType.h"
4 #include "OSGBaseInitFunctions.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)
15 case GL_STACK_OVERFLOW
:
16 case GL_STACK_UNDERFLOW
:
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",
40 fprintf(stderr
, " ProjectionStack %d %d\n",
44 fprintf(stderr
, " TextureStack %d %d\n",
52 int init(int argc
, char **argv
)
55 OSG::preloadSharedObject("OSGImageFileIO");
58 OSG::ChangeList::setReadWriteDefault(true);
60 OSG::osgInit(argc
,argv
);
62 OSG::GLErrorCallback
= dumpGLError
;
64 // Assume dir is given
67 // fprintf(stderr, "start from dir\n");
69 std::string szParamFilename
= argv
[1];
71 if(szParamFilename
[szParamFilename
.length() - 1] == '/')
73 szParamFilename
+= "params.csm";
77 szParamFilename
+= "/params.csm";
80 fprintf(stderr
, "Trying to start from : %s\n", szParamFilename
.c_str());
82 OSG::ComplexSceneManager::startFrom(szParamFilename
);
86 fprintf(stderr
, "start from arg\n");
88 OSG::ComplexSceneManager::the()->startFrom(argc
,
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
[] =
102 "Source/Contrib/ComplexSceneManager/data/system-native.osg",
106 "Source/Contrib/ComplexSceneManager/data/simple_mouse.osg"
111 OSG::ComplexSceneManager::the()->startFrom(
113 const_cast<char **>(argvTmp
));
115 OSG::ComplexSceneManager::the()->run();
123 int main (int argc
, char **argv
)