diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/geometry/vao.cpp | 22 | ||||
-rw-r--r-- | src/platform/gl.cpp | 14 | ||||
-rw-r--r-- | src/renderer/prerendered_texture.cpp | 4 |
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); } |