diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-14 13:49:53 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-18 13:27:35 +0200 |
commit | ee72e93f94c7b9ea20144287bcd473d35f07e9ed (patch) | |
tree | 2fd339d7f20cacf59d3e740a14417a62a02cef55 /src | |
parent | cd13e2b769a937a805ca4bc509c07524a6a949de (diff) | |
download | qtlocation-mapboxgl-ee72e93f94c7b9ea20144287bcd473d35f07e9ed.tar.gz |
[gl] Moved VAO helpers to common header
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/geometry/vao.cpp | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/src/mbgl/geometry/vao.cpp b/src/mbgl/geometry/vao.cpp index d3ad16e64f..d711df6f9f 100644 --- a/src/mbgl/geometry/vao.cpp +++ b/src/mbgl/geometry/vao.cpp @@ -6,54 +6,28 @@ namespace mbgl { -static gl::ExtensionFunction< - void (GLuint array)> - BindVertexArray({ - {"GL_ARB_vertex_array_object", "glBindVertexArray"}, - {"GL_OES_vertex_array_object", "glBindVertexArrayOES"}, - {"GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE"} - }); - -static gl::ExtensionFunction< - void (GLsizei n, - const GLuint* arrays)> - DeleteVertexArrays({ - {"GL_ARB_vertex_array_object", "glDeleteVertexArrays"}, - {"GL_OES_vertex_array_object", "glDeleteVertexArraysOES"}, - {"GL_APPLE_vertex_array_object", "glDeleteVertexArraysAPPLE"} - }); - -static gl::ExtensionFunction< - void (GLsizei n, - GLuint* arrays)> - GenVertexArrays({ - {"GL_ARB_vertex_array_object", "glGenVertexArrays"}, - {"GL_OES_vertex_array_object", "glGenVertexArraysOES"}, - {"GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE"} - }); - void VertexArrayObject::Unbind() { - if (!BindVertexArray) return; - MBGL_CHECK_ERROR(BindVertexArray(0)); + if (!gl::BindVertexArray) return; + MBGL_CHECK_ERROR(gl::BindVertexArray(0)); } void VertexArrayObject::Delete(GLsizei n, const GLuint* arrays) { - MBGL_CHECK_ERROR(DeleteVertexArrays(n, arrays)); + if (!gl::DeleteVertexArrays) return; + MBGL_CHECK_ERROR(gl::DeleteVertexArrays(n, arrays)); } VertexArrayObject::VertexArrayObject() { } VertexArrayObject::~VertexArrayObject() { - if (!DeleteVertexArrays) return; - + if (!gl::DeleteVertexArrays) return; if (vao) { util::ThreadContext::getGLObjectStore()->abandonVAO(vao); } } void VertexArrayObject::bindVertexArrayObject() { - if (!GenVertexArrays || !BindVertexArray) { + if (!gl::GenVertexArrays || !gl::BindVertexArray) { static bool reported = false; if (!reported) { Log::Warning(Event::OpenGL, "Not using Vertex Array Objects"); @@ -63,9 +37,9 @@ void VertexArrayObject::bindVertexArrayObject() { } if (!vao) { - MBGL_CHECK_ERROR(GenVertexArrays(1, &vao)); + MBGL_CHECK_ERROR(gl::GenVertexArrays(1, &vao)); } - MBGL_CHECK_ERROR(BindVertexArray(vao)); + MBGL_CHECK_ERROR(gl::BindVertexArray(vao)); } void VertexArrayObject::verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, |