Perhaps I just don't know enough about whats going on in my OSG build...but right now I can just instantiate and start a Viewer in OSG and it automatically opens a window and handles drawing for me. Is there a way to go about using OSG this same way but to incorporate SDL?
Right now when I try to grab SDL events while also running an osgViewer, my main function just exits as if the osgViewer isn't blocking the thread. My main function has the following code: Code: if( SDL_Init(SDL_INIT_JOYSTICK) < 0) { std::cerr << "unable to init SDL: " << SDL_GetError() << '\n'; return false; }else{ std::clog << "Init'd Joystick :)" << std::endl; } std::atexit(SDL_Quit); if( SDL_NumJoysticks() == 0 ) { std::cerr << "no joysticks found\n"; return false; }else{ std::clog << "Found " << SDL_NumJoysticks() << " joysticks :)" << std::endl << std::endl; for(int i = 0; i < SDL_NumJoysticks(); ++i) { std::clog << "Joystick " << (i + 1) << ": " << SDL_JoystickName(i) << std::endl << std::endl; } } SDL_Joystick *joystick; SDL_JoystickEventState(SDL_ENABLE); joystick = SDL_JoystickOpen(0); int running = true; SDL_Event event; std::clog << "Left/Right axis: " << SDL_JoystickGetAxis(joystick, 0) << std::endl; std::clog << "Up/Down axis: " << SDL_JoystickGetAxis(joystick, 1) << std::endl; // construct the viewer osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer; // make the viewer create a 512x512 window and position it at 32, 32 viewer->setUpViewInWindow( 32, 32, 512, 512 ); // set the scene-graph data the viewer will render viewer->setSceneData( CreateScene() ); // execute main loop return viewer->run(); I'm just trying to initialize SDL, grab initial joystick data to prove I am connected to it, then start the osgViewer. However, the OSG window never pops up... ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32151#32151 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org