2012-03-06 3 views
4

OpenGL에서 멀티 헤드 렌더링이 필요한 응용 프로그램을 개발 중입니다. 지금은 여러 화면으로 렌더링 할 수 있지만 마우스 커서의 이동은 단일 화면으로 제한됩니다. 그러나 렌더링 된 모든 화면에서 마우스 커서를 사용하고 싶습니다.Ogre3D, Multiple Monitors 및 Mouse Cursor

누구나이 동일한 문제를 겪었습니까? 그렇다면 해결 방법에 대해 어떻게 생각하십니까?

답변

6

나는 이것을위한 효과적인 해결책을 발견했다. 첫째, 내 Ogre::RenderWindow 창 모드에서 개체가 아닌 전체 화면 모드를 인스턴스화했다 - 전체 화면 모드과 같이 국경없는 Ogre::RenderWindow 객체를 인스턴스화하여 충분히 쉽게 모방했다 :

Ogre::NameValuePairList options; 
options["left"] = "0"; 
options["top"] = "0"; 
options["border"] = "none"; 
options["monitorIndex"] = "0"; 
m_pVisWindow[0] = mRoot->createRenderWindow("Window1", 1920, 1200, false, &options); 

options["monitorIndex"] = "1"; 
m_pVizWindow[1] = mRoot->createRenderWindow("Window2", 1920, 1200, false, &options); 

options["monitorIndex"] = "2"; 
m_pVizWindow[2] = mRoot->createRenderWindow("Window3", 1920, 1200, false, &options); 

options["monitorIndex"] = "3"; 
m_pVizWindow[3] = mRoot->createRenderWindow("Window4", 1920, 1200, false, &options); 

options["monitorIndex"] = "4"; 
m_pVizWindow[4] = mRoot->createRenderWindow("Window5", 1920, 1200, false, &options); 

options["monitorIndex"] = "5"; 
m_pVizWindow[5] = mRoot->createRenderWindow("Window6", 1920, 1200, false, &options); 

의 생성자에서 Ogre::FrameListenerOgre::RenderWindow (여기서는 ExampleFrameListener으로부터 상속 받음)에서 기존의 mInputManager을 파괴하고 비 독점적 인 입력을 위해 OIS을 구성하기위한 매개 변수로 새 인스턴스를 인스턴스화해야했습니다. 어떻게 그리고 왜해야하는지에 대한 자세한 설명 찾을 수 있습니다 here.

mInputManager->destroyInputObject(mMouse); 
mInputManager->destroyInputObject(mKeyboard); 
mInputManager->destroyInputObject(mJoy); 
OIS::InputManager::destroyInputSystem(mInputManager); 

// override OIS construction to avoid grabbing mouse 
OIS::ParamList pl; 
size_t windowHnd = 0; 
std::ostringstream windowHndStr; 

window->getCustomAttribute("WINDOW", &windowHnd); 
windowHndStr << windowHnd; 
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); 
#if defined OIS_WIN32_PLATFORM 
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND"))); 
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE"))); 
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND"))); 
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE"))); 
#elif defined OIS_LINUX_PLATFORM 
pl.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false"))); 
pl.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false"))); 
pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false"))); 
pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true"))); 
#endif 

mInputManager = OIS::InputManager::createInputSystem(pl); 

//Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) 
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false)); 
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false)); 
try { 
    mJoy = static_cast<OIS::JoyStick*>(mInputManager->createInputObject(OIS::OISJoyStick, false)); 
} 
catch(...) { 
    mJoy = 0; 
} 

초점을 맞추기 위해 특정 렌더링 창을 물리적으로 클릭해야하기 때문에 mouseover 이벤트의 렌더링 창에 포커스를 부여하는 방법이 있으면 좋을 것입니다. 지금 내 필요 ...