From 0e928b5204ad5e2a8cfc1dd1a993396be0bd9d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Fri, 24 Oct 2014 17:39:18 +0200 Subject: make tests work --- common/glx.h | 2 -- common/headless_display.cpp | 74 --------------------------------------------- common/headless_display.hpp | 25 --------------- 3 files changed, 101 deletions(-) delete mode 100644 common/glx.h delete mode 100644 common/headless_display.cpp delete mode 100644 common/headless_display.hpp (limited to 'common') diff --git a/common/glx.h b/common/glx.h deleted file mode 100644 index 6b7d9a3df9..0000000000 --- a/common/glx.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -#undef None diff --git a/common/headless_display.cpp b/common/headless_display.cpp deleted file mode 100644 index 3aaf2020b9..0000000000 --- a/common/headless_display.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "headless_display.hpp" - -#include -#include - -namespace mbgl { - -HeadlessDisplay::HeadlessDisplay() { -#if MBGL_USE_CGL - // TODO: test if OpenGL 4.1 with GL_ARB_ES2_compatibility is supported - // If it is, use kCGLOGLPVersion_3_2_Core and enable that extension. - CGLPixelFormatAttribute attributes[] = { - kCGLPFAOpenGLProfile, - (CGLPixelFormatAttribute) kCGLOGLPVersion_Legacy, - kCGLPFAAccelerated, - (CGLPixelFormatAttribute) 0 - }; - - GLint num; - CGLError error = CGLChoosePixelFormat(attributes, &pixelFormat, &num); - if (error) { - fprintf(stderr, "Error pixel format: %s\n", CGLErrorString(error)); - return; - } -#endif - -#if MBGL_USE_GLX - if (!XInitThreads()) { - throw std::runtime_error("Failed to XInitThreads"); - } - - x_display = XOpenDisplay(nullptr); - if (x_display == nullptr) { - throw std::runtime_error("Failed to open X display"); - } - - const char *extensions = (char *)glXQueryServerString(x_display, DefaultScreen(x_display), GLX_EXTENSIONS); - if (!extensions) { - throw std::runtime_error("Cannot read GLX extensions"); - } - if (!strstr(extensions,"GLX_SGIX_fbconfig")) { - throw std::runtime_error("Extension GLX_SGIX_fbconfig was not found"); - } - if (!strstr(extensions, "GLX_SGIX_pbuffer")) { - throw std::runtime_error("Cannot find glXCreateContextAttribsARB"); - } - - // We're creating a dummy pbuffer anyway that we're not using. - static int pixelFormat[] = { - GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, - None - }; - - int configs = 0; - fb_configs = glXChooseFBConfig(x_display, DefaultScreen(x_display), pixelFormat, &configs); - if (configs <= 0) { - throw std::runtime_error("No Framebuffer configurations"); - } -#endif -} - -HeadlessDisplay::~HeadlessDisplay() { -#if MBGL_USE_CGL - CGLDestroyPixelFormat(pixelFormat); -#endif - -#if MBGL_USE_GLX - XFree(fb_configs); - XCloseDisplay(x_display); -#endif -} - -} - diff --git a/common/headless_display.hpp b/common/headless_display.hpp deleted file mode 100644 index 5b33fd6990..0000000000 --- a/common/headless_display.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MBGL_COMMON_HEADLESS_DISPLAY -#define MBGL_COMMON_HEADLESS_DISPLAY - -#include "headless_view.hpp" - -namespace mbgl { - -class HeadlessDisplay { -public: - HeadlessDisplay(); - ~HeadlessDisplay(); - -#if MBGL_USE_CGL - CGLPixelFormatObj pixelFormat; -#endif - -#if MBGL_USE_GLX - Display *x_display = nullptr; - GLXFBConfig *fb_configs = nullptr; -#endif -}; - -} - -#endif -- cgit v1.2.1