Operating System: Windows 10
Render System: OpenGL
Hi,
What is the correct way to use Ogre with SDL? I have used Ogre on its own before, but am rather confused with how you are supposed to integrate it with SDL to use it for input. As expected SDL needs to be initialised to be able to detect input, which involves creating an SDL window. As well as this though, obviously Ogre's initialisation requires creating a window too. I have read several bits of documentation on this, but when I try and implement the code, it doesn't seem to explain how the render window situation works? Are you supposed to somehow hide one of the windows, or is there a way to render one into another or something?
Code: Select all
if (SDL_Init(SDL_INIT_VIDEO) != 0)
Log::write("Unable to initialise SDL");
m_SDLwindow.reset(SDL_CreateWindow("Go-Karting", 25, 25, 800, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL));
SDL_SysWMinfo wmInfo;
SDL_GetVersion(&wmInfo.version);
if (!SDL_GetWindowWMInfo(m_SDLwindow.get(), &wmInfo))
{
Ogre::LogManager::getSingleton().logMessage(Ogre::String("Couldn't get WM info"));
}
Ogre::String winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window);
Ogre::NameValuePairList params;
params["ExternalWindowHandle"] = winHandle;
m_root.reset(new Ogre::Root(m_pluginsFileName, m_resourcesFileName));
m_root->setRenderSystem(m_root->getRenderSystemByName("OpenGL Rendering Subsystem"));
m_root->showConfigDialog(NULL);
m_root->initialise(false);
m_window.reset(m_root->createRenderWindow("Go-Karting", 800, 600, false, ¶ms));
Thanks