fixes #838 instead of rendering ad libitum on the map thread, we are now driving rendering from the UI thread on iOS via the map.renderSync() function. There are still white bars during the rotation, but the general content of the view is kept visible. - upgrades GLFW to 3.1 - removes swapped/needsSwap in favor of a more explicit scheme - View#invalidate() now replaces View#swap() and is called whenever the View needs to trigger a rerender. GLFW and Android to this right away, while iOS goes back to the main thread and does the Map redrawing as part of the GLKView update - sets all iOS deployment targets to 7.0 - disables SQLite3 version check, since the library version changed on iOS 8.2
72 lines
1.4 KiB
C++
72 lines
1.4 KiB
C++
#ifndef MBGL_COMMON_HEADLESS_VIEW
|
|
#define MBGL_COMMON_HEADLESS_VIEW
|
|
|
|
#ifdef __APPLE__
|
|
#define MBGL_USE_CGL 1
|
|
#else
|
|
#define GL_GLEXT_PROTOTYPES
|
|
#define MBGL_USE_GLX 1
|
|
typedef struct _XDisplay Display;
|
|
typedef struct __GLXcontextRec* GLXContext;
|
|
typedef struct __GLXFBConfigRec* GLXFBConfig;
|
|
typedef long unsigned int XID;
|
|
typedef XID GLXPbuffer;
|
|
#endif
|
|
|
|
#include <mbgl/mbgl.hpp>
|
|
#include <mbgl/platform/gl.hpp>
|
|
|
|
#include <memory>
|
|
|
|
namespace mbgl {
|
|
|
|
class HeadlessDisplay;
|
|
|
|
class HeadlessView : public View {
|
|
public:
|
|
HeadlessView();
|
|
HeadlessView(std::shared_ptr<HeadlessDisplay> display);
|
|
~HeadlessView();
|
|
|
|
void createContext();
|
|
void loadExtensions();
|
|
|
|
void resize(uint16_t width, uint16_t height, float pixelRatio);
|
|
std::unique_ptr<uint32_t[]> readPixels();
|
|
|
|
void activate() override;
|
|
void deactivate() override;
|
|
void notify() override;
|
|
void invalidate() override;
|
|
|
|
private:
|
|
void clearBuffers();
|
|
|
|
private:
|
|
std::shared_ptr<HeadlessDisplay> display_;
|
|
uint16_t width_;
|
|
uint16_t height_;
|
|
float pixelRatio_;
|
|
|
|
#if MBGL_USE_CGL
|
|
CGLContextObj glContext;
|
|
#endif
|
|
|
|
#if MBGL_USE_GLX
|
|
Display *xDisplay = nullptr;
|
|
GLXFBConfig *fbConfigs = nullptr;
|
|
GLXContext glContext = 0;
|
|
GLXPbuffer glxPbuffer = 0;
|
|
#endif
|
|
|
|
bool extensionsLoaded = false;
|
|
|
|
GLuint fbo = 0;
|
|
GLuint fboDepthStencil = 0;
|
|
GLuint fboColor = 0;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|