| 28 | namespace cinder { namespace app { |
| 29 | |
| 30 | WindowImplLinux::WindowImplLinux( const Window::Format &format, WindowImplLinux *sharedRendererWindow, AppImplLinux *appImpl ) |
| 31 | : mAppImpl( appImpl ) |
| 32 | { |
| 33 | mFullScreen = format.isFullScreen(); |
| 34 | mDisplay = format.getDisplay(); |
| 35 | |
| 36 | if( ! mDisplay ) |
| 37 | mDisplay = Display::getMainDisplay(); |
| 38 | |
| 39 | mRenderer = format.getRenderer(); |
| 40 | |
| 41 | GLFWwindow *sharedGlfwWindow = nullptr; |
| 42 | if( sharedRendererWindow ) |
| 43 | sharedGlfwWindow = reinterpret_cast<GLFWwindow*>( sharedRendererWindow->getNative() ); |
| 44 | |
| 45 | const auto& options = std::dynamic_pointer_cast<RendererGl>( mRenderer )->getOptions(); |
| 46 | #if defined( CINDER_GL_ES ) |
| 47 | ::glfwDefaultWindowHints(); |
| 48 | ::glfwWindowHint( GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API ); |
| 49 | ::glfwWindowHint( GLFW_CLIENT_API, GLFW_OPENGL_ES_API ); |
| 50 | #if CINDER_GL_ES_VERSION >= CINDER_GL_ES_VERSION_3_2 |
| 51 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 ); |
| 52 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 2 ); |
| 53 | std::cout << "Rendering with OpenGL ES 3.2" << std::endl; |
| 54 | #elif CINDER_GL_ES_VERSION >= CINDER_GL_ES_VERSION_3_1 |
| 55 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 ); |
| 56 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 1 ); |
| 57 | std::cout << "Rendering with OpenGL ES 3.1" << std::endl; |
| 58 | #elif CINDER_GL_ES_VERSION >= CINDER_GL_ES_VERSION_3 |
| 59 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 ); |
| 60 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 ); |
| 61 | std::cout << "Rendering with OpenGL ES 3.0" << std::endl; |
| 62 | #elif CINDER_GL_ES_VERSION >= CINDER_GL_ES_VERSION_2 |
| 63 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 2 ); |
| 64 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 ); |
| 65 | std::cout << "Rendering with OpenGL ES 2.0" << std::endl; |
| 66 | #endif |
| 67 | |
| 68 | #else // Desktop |
| 69 | int32_t majorVersion = options.getVersion().first; |
| 70 | int32_t minorVersion = options.getVersion().second; |
| 71 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, majorVersion ); |
| 72 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, minorVersion ); |
| 73 | ::glfwWindowHint( GLFW_DECORATED, format.isBorderless() ? GL_FALSE : GL_TRUE ); |
| 74 | ::glfwWindowHint( GLFW_RESIZABLE, format.isResizable() ? GL_TRUE : GL_FALSE ); |
| 75 | ::glfwWindowHint( GLFW_FLOATING, format.isAlwaysOnTop() ? GL_TRUE : GL_FALSE ); |
| 76 | if( options.getCoreProfile() ) { |
| 77 | ::glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE ); |
| 78 | std::cout << "Rendering with OpenGL Core Profile " << majorVersion << "." << minorVersion << std::endl; |
| 79 | } |
| 80 | else { |
| 81 | std::cout << "Rendering with OpenGL " << majorVersion << "." << minorVersion << std::endl; |
| 82 | } |
| 83 | if( options.getDebug() ) |
| 84 | ::glfwWindowHint( GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE ); |
| 85 | #endif |
| 86 | |
| 87 | ::glfwWindowHint( GLFW_SAMPLES, options.getMsaa() ); |
nothing calls this directly
no test coverage detected