summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-29 14:51:07 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-08 08:09:28 -0800
commit36210fe4e9c68a52dedc90548d90e77cf39a2228 (patch)
treebe6f8e5c84f98094a372fc7518a5384fd37563bc /src/mbgl/gl/attribute.cpp
parent687ee1e1c92275f65469412591ff262b46e7ccd9 (diff)
downloadqtlocation-mapboxgl-36210fe4e9c68a52dedc90548d90e77cf39a2228.tar.gz
[core] Make attribute binding more similar to uniform binding
Diffstat (limited to 'src/mbgl/gl/attribute.cpp')
-rw-r--r--src/mbgl/gl/attribute.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mbgl/gl/attribute.cpp b/src/mbgl/gl/attribute.cpp
new file mode 100644
index 0000000000..81ab6ac2a5
--- /dev/null
+++ b/src/mbgl/gl/attribute.cpp
@@ -0,0 +1,24 @@
+#include <mbgl/gl/attribute.hpp>
+#include <mbgl/gl/gl.hpp>
+
+namespace mbgl {
+namespace gl {
+
+void bindAttribute(AttributeLocation location,
+ std::size_t count,
+ DataType type,
+ std::size_t vertexSize,
+ std::size_t vertexOffset,
+ std::size_t attributeOffset) {
+ MBGL_CHECK_ERROR(glEnableVertexAttribArray(location));
+ MBGL_CHECK_ERROR(glVertexAttribPointer(
+ location,
+ static_cast<GLint>(count),
+ static_cast<GLenum>(type),
+ GL_FALSE,
+ static_cast<GLsizei>(vertexSize),
+ reinterpret_cast<GLvoid*>(attributeOffset + (vertexSize * vertexOffset))));
+}
+
+} // namespace gl
+} // namespace mbgl