void GlfwApp::preCreate() { glfwWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Without this line we get // FATAL (86): NSGL: The targeted version of OS X only supports OpenGL 3.2 and later versions if they are forward-compatible ON_MAC([]{ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); }); #ifdef RIFT_DEBUG glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); #endif }
void * getNativeWindowHandle(GLFWwindow * window) { void * nativeWindowHandle = nullptr; ON_WINDOWS([&] { nativeWindowHandle = (void*)glfwGetWin32Window(window); }); ON_LINUX([&] { nativeWindowHandle = (void*)glfwGetX11Window(window); }); ON_MAC([&] { nativeWindowHandle = (void*)glfwGetCocoaWindow(window); }); return nativeWindowHandle; }