summaryrefslogtreecommitdiff
path: root/src/geometry/vao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry/vao.cpp')
-rw-r--r--src/geometry/vao.cpp22
1 files changed, 15 insertions, 7 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
-
}