From: Simon R. <sra...@st...> - 2010-03-25 21:40:36
|
Dear Huang, Am Donnerstag 25 März 2010 15:04:43 schrieben Sie: > after I start it from term I ran into the same error some days ago. The SDL input system provides a timer. If you disable "sparkSetupInput()" in simspark.rb the simulation runs too fast (at least on my machine). Usually rcssserver3d runs fine from a terminal, but not on CentOS. Why? Because IMO there is an error in spark/plugin/inputsdl/inputsystemsdl.cpp (line 88 and the following block in the current SVN trunk): if (!SDL_WasInit(SDL_INIT_VIDEO)) { .... } The input system tries to open a video device. For some reason this works in a plain terminal on a standard Ubuntu installation, but it doesn't on CentOS. I suspect CentOS lacks a fallback method (virtual framebuffer, svgalib etc.) in case there's no X11 session running, and Ubuntu has one in place. The video device is not needed, SDL_Init(SDL_INIT_TIMER) is enough to get everyhting up and running. Maybe that's the reason why most of the code was already commented out. I just removed the whole block (see the following patch) and didn't have any problems until now, neither on CentOS nor elsewhere. Please correct me if I'm wrong, otherwise this should be corrected in SVN trunk. Index: spark/plugin/inputsdl/inputsystemsdl.cpp =================================================================== --- spark/plugin/inputsdl/inputsystemsdl.cpp (revision 188) +++ spark/plugin/inputsdl/inputsystemsdl.cpp (working copy) @@ -83,33 +83,6 @@ { if (InputSystem::Init(inputServer) == false) return false; - // here we check whether SDL has been initialized prior to adding this - // input is part of the video subsystem (because of event loops, etc..) - if (!SDL_WasInit(SDL_INIT_VIDEO)) - { - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) - { - GetLog()->Error() << "ERROR: (InputSystemSDL) SDL not initialized!\n"; - return false; - } -// SDL_SetVideoMode(0,0,0,0); -// static SDL_SysWMinfo pInfo; -// SDL_VERSION(&pInfo.version); -// SDL_GetWMInfo(&pInfo); - - // Also, SDL keeps an internal record of the window size - // and position. Because SDL does not own the window, it - // missed the WM_POSCHANGED message and has no record of - // either size or position. It defaults to {0, 0, 0, 0}, - // which is then used to trap the mouse "inside the - // window". We have to fake a window-move to allow SDL - // to catch up, after which we can safely grab input. -// RECT r; -// GetWindowRect(pInfo.window, &r); -// SetWindowPos(pInfo.window, 0, r.left, r.top, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -// SDL_WM_GrabInput(SDL_GRAB_ON); - } - if (!SDL_WasInit(SDL_INIT_TIMER)) { if (SDL_Init(SDL_INIT_TIMER) < 0) -- mit freundlichen Grüßen/regards/cordiali saluti Simon Raffeiner University of Applied Sciences Offenburg, Germany Department of Computer Science, RoboCup Team |