//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2017 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// #include "MacOS/BsMacOSGLSupport.h" #include "MacOS/BsMacOSContext.h" #include "MacOS/BsMacOSRenderWindow.h" #include "BsMacOSVideoModeInfo.h" #include "BsGLRenderAPI.h" #include namespace bs::ct { SPtr MacOSGLSupport::newWindow( RENDER_WINDOW_DESC& desc, UINT32 windowId, SPtr parentWindow) { bs::MacOSRenderWindow* window = new (bs_alloc()) bs::MacOSRenderWindow(desc, windowId, *this); return SPtr(window, &bs::CoreObject::_delete); } void MacOSGLSupport::start() { // Do nothing } void MacOSGLSupport::stop() { // Do nothing } SPtr MacOSGLSupport::createContext(bool depthStencil, UINT32 msaaCount) { GLRenderAPI* rapi = static_cast(RenderAPI::instancePtr()); // If RenderAPI has initialized a context use that, otherwise we create our own if (!rapi->_isContextInitialized()) return bs_shared_ptr_new(depthStencil, msaaCount); else { SPtr context = rapi->_getMainContext(); return std::static_pointer_cast(context); } } void* MacOSGLSupport::getProcAddress(const String& procname) { static void* image = nullptr; if (!image) image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); if(!image) return nullptr; return dlsym(image, (const char*)procname.c_str()); } SPtr MacOSGLSupport::getVideoModeInfo() const { return bs_shared_ptr_new(); } }