[reporter="RandomCitizen", created="Fri, 4 Oct 2013 23:10:22 +0200"]
I am creating a OpenGl Window using SDL 2
Take a lok at the following piece of code:
// The Sdl2 Window `sdlWindow` is created earlier const bool USE_NSVIEW = true; SDL_SysWMinfo windowInfo; SDL_VERSION(&windowInfo.version); SDL_GetWindowWMInfo(sdlWindow, &windowInfo); if(windowInfo.subsystem != SDL_SYSWM_COCOA) throw Ogre::InvalidStateException(0, Ogre::String("Unexpeced SDL Window subsystem: ") + std::to_string(windowInfo.subsystem), "getOSSpecificWindowHandle", __FILE__, __LINE__); NSWindow *window = windowInfo.info.cocoa.window; size_t handle; miscParameters["macAPI"] = "cocoa"; if(USE_NSVIEW) { NSView *view = [window contentView]; miscParameters["macAPICocoaUseNSView"] = "true"; handle = reinterpret_cast(view); }else { miscParameters["macAPICocoaUseNSView"] = "false"; handle = reinterpret_cast(window); } miscParameters["currentGLContext"] = "True"; miscParameters["externalGLContext"] = "True"; miscParameters["externalWindowHandle"] = Ogre::StringConverter::toString(handle, 0);
This code gives an NSView* pointer to Ogre and it just works fine. But when using the NSWindow* pointer itself by just setting the const bool USE_NSVIEW variable to false, ogre crashes.
该提问来源于开源项目:OGRECave/ogre