summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-11-07 18:17:24 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-11-07 18:17:24 +0100
commit582d616deb5b1febbaa1c8dfb5e3fb405f8cad53 (patch)
treedde9456630f0e529ca0f062023b876721b11a3ed /src
parent7e65c88b464b2faa35f8aa9c3ec3029d5c359393 (diff)
downloadqtlocation-mapboxgl-582d616deb5b1febbaa1c8dfb5e3fb405f8cad53.tar.gz
load VAO extension
Diffstat (limited to 'src')
-rw-r--r--src/geometry/vao.cpp22
-rw-r--r--src/platform/gl.cpp14
-rw-r--r--src/renderer/prerendered_texture.cpp4
3 files changed, 30 insertions, 10 deletions
diff --git a/src/geometry/vao.cpp b/src/geometry/vao.cpp
index 4c459c436d..d2fd2727ef 100644
--- a/src/geometry/vao.cpp
+++ b/src/geometry/vao.cpp
@@ -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 (!gl::GenVertexArrays || !gl::BindVertexArray) {
+ static bool reported = false;
+ if (!reported) {
+ Log::Warning(Event::OpenGL, "Not using Vertex Array Objects");
+ reported = true;
+ }
+ return;
+ }
+
if (!vao) {
- glGenVertexArrays(1, &vao);
+ gl::GenVertexArrays(1, &vao);
}
- glBindVertexArray(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
-
}
diff --git a/src/platform/gl.cpp b/src/platform/gl.cpp
index a1bf0ffc6c..3133f128b9 100644
--- a/src/platform/gl.cpp
+++ b/src/platform/gl.cpp
@@ -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;
diff --git a/src/renderer/prerendered_texture.cpp b/src/renderer/prerendered_texture.cpp
index adb7a59105..c9507d6026 100644
--- a/src/renderer/prerendered_texture.cpp
+++ b/src/renderer/prerendered_texture.cpp
@@ -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);
}