summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-29 12:15:36 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-29 10:17:47 -0700
commit15aece8a30dcc1f1f97e28180edda46d05641a2d (patch)
tree51284a75c6aa16614192988641ce71f59c794dd8 /src/mbgl/geometry
parentd1a84d9b51a7145f9f7665805cf71050aac7bc63 (diff)
downloadqtlocation-mapboxgl-15aece8a30dcc1f1f97e28180edda46d05641a2d.tar.gz
[core] introduces types for GL objects
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r--src/mbgl/geometry/buffer.hpp2
-rw-r--r--src/mbgl/geometry/vao.cpp12
-rw-r--r--src/mbgl/geometry/vao.hpp18
3 files changed, 21 insertions, 11 deletions
diff --git a/src/mbgl/geometry/buffer.hpp b/src/mbgl/geometry/buffer.hpp
index 8e58af8927..2faa9a9d84 100644
--- a/src/mbgl/geometry/buffer.hpp
+++ b/src/mbgl/geometry/buffer.hpp
@@ -70,7 +70,7 @@ public:
}
}
- GLuint getID() const {
+ gl::BufferID getID() const {
return buffer ? *buffer : 0;
}
diff --git a/src/mbgl/geometry/vao.cpp b/src/mbgl/geometry/vao.cpp
index 0f29d65cf9..d7bddcac7a 100644
--- a/src/mbgl/geometry/vao.cpp
+++ b/src/mbgl/geometry/vao.cpp
@@ -28,8 +28,10 @@ void VertexArrayObject::bindVertexArrayObject(gl::Context& context) {
context.vertexArrayObject = *vertexArray;
}
-void VertexArrayObject::verifyBinding(Shader& shader, GLuint vertexBuffer, GLuint elementsBuffer,
- GLbyte *offset) {
+void VertexArrayObject::verifyBinding(Shader& shader,
+ gl::BufferID vertexBuffer,
+ gl::BufferID elementsBuffer,
+ GLbyte* offset) {
if (bound_shader != shader.getID()) {
throw std::runtime_error(std::string("trying to rebind VAO to another shader from " +
util::toString(bound_shader) + "(" + bound_shader_name + ") to " +
@@ -43,8 +45,10 @@ void VertexArrayObject::verifyBinding(Shader& shader, GLuint vertexBuffer, GLuin
}
}
-void VertexArrayObject::storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer,
- GLbyte *offset) {
+void VertexArrayObject::storeBinding(Shader& shader,
+ gl::BufferID vertexBuffer,
+ gl::BufferID elementsBuffer,
+ GLbyte* offset) {
bound_shader = shader.getID();
bound_shader_name = shader.name;
bound_offset = offset;
diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp
index a9e69c938f..42527a7ad6 100644
--- a/src/mbgl/geometry/vao.hpp
+++ b/src/mbgl/geometry/vao.hpp
@@ -51,23 +51,29 @@ public:
}
}
- GLuint getID() const {
+ gl::VertexArrayID getID() const {
return *vertexArray;
}
private:
void bindVertexArrayObject(gl::Context&);
- void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset);
- void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset);
+ void storeBinding(Shader& shader,
+ gl::BufferID vertexBuffer,
+ gl::BufferID elementsBuffer,
+ GLbyte* offset);
+ void verifyBinding(Shader& shader,
+ gl::BufferID vertexBuffer,
+ gl::BufferID elementsBuffer,
+ GLbyte* offset);
mbgl::optional<gl::UniqueVertexArray> vertexArray;
// For debug reasons, we're storing the bind information so that we can
// detect errors and report
- GLuint bound_shader = 0;
+ gl::ProgramID bound_shader = 0;
const char* bound_shader_name = "";
- GLuint bound_vertex_buffer = 0;
- GLuint bound_elements_buffer = 0;
+ gl::BufferID bound_vertex_buffer = 0;
+ gl::BufferID bound_elements_buffer = 0;
GLbyte *bound_offset = nullptr;
};