Merge branch 'master' of https://github.com/mapbox/mapbox-gl-native into android-mason

Conflicts:
	gyp/common.gypi
	include/mbgl/geometry/vao.hpp
	include/mbgl/platform/event.hpp
	include/mbgl/platform/gl.hpp
	platform/default/http_request_baton_curl.cpp
	src/storage/response.cpp
This commit is contained in:
Leith Bade
2014-11-09 00:35:52 +11:00
21 changed files with 396 additions and 231 deletions

View File

@@ -9,7 +9,6 @@
namespace mbgl {
#if GL_ARB_vertex_array_object
class VertexArrayObject : public util::noncopyable {
public:
inline VertexArrayObject() {};
@@ -28,7 +27,9 @@ public:
if (bound_shader == 0) {
vertexBuffer.bind();
shader.bind(offset);
storeBinding(shader, vertexBuffer.getID(), 0, offset);
if (vao) {
storeBinding(shader, vertexBuffer.getID(), 0, offset);
}
} else {
verifyBinding(shader, vertexBuffer.getID(), 0, offset);
}
@@ -41,7 +42,9 @@ public:
vertexBuffer.bind();
elementsBuffer.bind();
shader.bind(offset);
storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset);
if (vao) {
storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset);
}
} else {
verifyBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset);
}
@@ -65,30 +68,6 @@ private:
char *bound_offset = 0;
};
#else
class VertexArrayObject : public util::noncopyable {
public:
inline VertexArrayObject() {};
inline VertexArrayObject(VertexArrayObject &&) noexcept {};
template <typename Shader, typename VertexBuffer>
inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) {
vertexBuffer.bind();
shader.bind(offset);
}
template <typename Shader, typename VertexBuffer, typename ElementsBuffer>
inline void bind(Shader& shader, VertexBuffer &vertexBuffer, ElementsBuffer &elementsBuffer, char *offset) {
vertexBuffer.bind();
elementsBuffer.bind();
shader.bind(offset);
}
};
#endif
}
#endif
#endif

View File

@@ -25,6 +25,7 @@ public:
~HeadlessView();
void createContext();
void loadExtensions();
void resize(uint16_t width, uint16_t height, float pixelRatio);
std::unique_ptr<uint32_t[]> readPixels();

View File

@@ -33,6 +33,7 @@ enum class Event : uint8_t {
HttpRequest,
Sprite,
Image,
OpenGL,
};
MBGL_DEFINE_ENUM_CLASS(EventClass, Event, {
@@ -46,6 +47,7 @@ MBGL_DEFINE_ENUM_CLASS(EventClass, Event, {
{ Event::HttpRequest, "HttpRequest" },
{ Event::Sprite, "Sprite" },
{ Event::Image, "Image" },
{ Event::OpenGL, "OpenGL" },
{ Event(-1), "Unknown" },
});

View File

@@ -3,35 +3,22 @@
#include <string>
#ifdef NVIDIA
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
extern PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT;
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#elif __APPLE__
#if __APPLE__
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#define glGenVertexArrays glGenVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glDeleteVertexArrays glDeleteVertexArraysOES
#define GL_ARB_vertex_array_object 1
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
// #define glGenVertexArrays glGenVertexArraysOES
// #define glBindVertexArray glBindVertexArrayOES
// #define glDeleteVertexArrays glDeleteVertexArraysOES
// #define GL_ARB_vertex_array_object 1
// #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#elif TARGET_IPHONE_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif TARGET_OS_MAC
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#if GL_APPLE_vertex_array_object
#define GL_ARB_vertex_array_object 1
#define glGenVertexArrays glGenVertexArraysAPPLE
#define glBindVertexArray glBindVertexArrayAPPLE
#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
#endif
#else
#error Unsupported Apple platform
#endif
@@ -39,7 +26,6 @@
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
@@ -48,8 +34,19 @@
namespace mbgl {
namespace gl {
typedef void (* PFNGLBINDVERTEXARRAYPROC) (GLuint array);
typedef void (* PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);
typedef void (* PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);
typedef GLboolean (* PFNGLISVERTEXARRAYPROC) (GLuint array);
extern PFNGLBINDVERTEXARRAYPROC BindVertexArray;
extern PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
extern PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
extern PFNGLISVERTEXARRAYPROC IsVertexArray;
// Debug group markers, useful for debuggin on iOS
#if defined(__APPLE__) && defined(DEBUG) && defined(GL_EXT_debug_marker)
#if __APPLE__ && defined(DEBUG) && defined(GL_EXT_debug_marker)
// static int indent = 0;
inline void start_group(const std::string &str) {
glPushGroupMarkerEXT(0, str.c_str());

View File

@@ -27,7 +27,7 @@ namespace bgi = bg::index;
typedef bgm::point<float, 2, bg::cs::cartesian> Point;
typedef bgm::box<Point> Box;
typedef std::pair<Box, PlacementBox> PlacementValue;
typedef bgi::rtree<PlacementValue, bgi::rstar<16>> Tree;
typedef bgi::rtree<PlacementValue, bgi::linear<16,4>> Tree;
class Collision {