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

@@ -1,20 +1,30 @@
#include <mbgl/geometry/vao.hpp>
#include <mbgl/platform/log.hpp>
namespace mbgl {
#if GL_ARB_vertex_array_object
VertexArrayObject::~VertexArrayObject() {
if (!gl::DeleteVertexArrays) return;
if (vao) {
glDeleteVertexArrays(1, &vao);
gl::DeleteVertexArrays(1, &vao);
}
}
void VertexArrayObject::bindVertexArrayObject() {
if (!vao) {
glGenVertexArrays(1, &vao);
if (!gl::GenVertexArrays || !gl::BindVertexArray) {
static bool reported = false;
if (!reported) {
Log::Warning(Event::OpenGL, "Not using Vertex Array Objects");
reported = true;
}
return;
}
glBindVertexArray(vao);
if (!vao) {
gl::GenVertexArrays(1, &vao);
}
gl::BindVertexArray(vao);
}
void VertexArrayObject::verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer,
@@ -41,6 +51,4 @@ void VertexArrayObject::storeBinding(Shader &shader, GLuint vertexBuffer, GLuint
bound_elements_buffer = elementsBuffer;
}
#endif
}

View File

@@ -75,7 +75,10 @@ void TileData::request() {
void TileData::cancel() {
if (state != State::obsolete) {
state = State::obsolete;
req.reset();
if (req) {
req->cancel();
req.reset();
}
}
}

View File

@@ -2,9 +2,17 @@
#include <iostream>
#ifdef NVIDIA
PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT;
#endif
namespace mbgl {
namespace gl {
PFNGLBINDVERTEXARRAYPROC BindVertexArray = nullptr;
PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays = nullptr;
PFNGLGENVERTEXARRAYSPROC GenVertexArrays = nullptr;
PFNGLISVERTEXARRAYPROC IsVertexArray = nullptr;
}
}
void _CHECK_GL_ERROR(const char *cmd, const char *file, int line) {
std::cout << cmd << ";" << std::endl;

View File

@@ -49,7 +49,11 @@ void PrerenderedTexture::bindFramebuffer() {
// Create depth/stencil buffer
glGenRenderbuffers(1, &fbo_depth_stencil);
glBindRenderbuffer(GL_RENDERBUFFER, fbo_depth_stencil);
#ifdef GL_ES_VERSION_2_0
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, properties.size, properties.size);
#else
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, properties.size, properties.size);
#endif
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}

View File

@@ -6,10 +6,10 @@ namespace mbgl {
int64_t Response::parseCacheControl(const char *value) {
if (value) {
uint64_t seconds = 0;
unsigned long long seconds = 0;
// TODO: cache-control may contain other information as well:
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
if (std::sscanf(value, "max-age=%llu", reinterpret_cast<unsigned long long *>(&seconds)) == 1) {
if (std::sscanf(value, "max-age=%llu", &seconds) == 1) {
return std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count() +
seconds;