summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/context.hpp
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/gl/context.hpp
parentd1a84d9b51a7145f9f7665805cf71050aac7bc63 (diff)
downloadqtlocation-mapboxgl-15aece8a30dcc1f1f97e28180edda46d05641a2d.tar.gz
[core] introduces types for GL objects
Diffstat (limited to 'src/mbgl/gl/context.hpp')
-rw-r--r--src/mbgl/gl/context.hpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index cd42e02fc0..133a56b6f8 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -21,12 +21,16 @@ public:
return UniqueProgram { MBGL_CHECK_ERROR(glCreateProgram()), { this } };
}
- UniqueShader createShader(GLenum type) {
- return UniqueShader { MBGL_CHECK_ERROR(glCreateShader(type)), { this } };
+ UniqueShader createVertexShader() {
+ return UniqueShader { MBGL_CHECK_ERROR(glCreateShader(GL_VERTEX_SHADER)), { this } };
+ }
+
+ UniqueShader createFragmentShader() {
+ return UniqueShader { MBGL_CHECK_ERROR(glCreateShader(GL_FRAGMENT_SHADER)), { this } };
}
UniqueBuffer createBuffer() {
- GLuint id = 0;
+ BufferID id = 0;
MBGL_CHECK_ERROR(glGenBuffers(1, &id));
return UniqueBuffer { std::move(id), { this } };
}
@@ -37,19 +41,19 @@ public:
MBGL_CHECK_ERROR(glGenTextures(TextureMax, pooledTextures.data()));
}
- GLuint id = pooledTextures.back();
+ TextureID id = pooledTextures.back();
pooledTextures.pop_back();
return UniqueTexture { std::move(id), { this } };
}
UniqueVertexArray createVertexArray() {
- GLuint id = 0;
+ VertexArrayID id = 0;
MBGL_CHECK_ERROR(gl::GenVertexArrays(1, &id));
return UniqueVertexArray { std::move(id), { this } };
}
UniqueFramebuffer createFramebuffer() {
- GLuint id = 0;
+ FramebufferID id = 0;
MBGL_CHECK_ERROR(glGenFramebuffers(1, &id));
return UniqueFramebuffer { std::move(id), { this } };
}
@@ -113,14 +117,14 @@ private:
friend detail::VertexArrayDeleter;
friend detail::FramebufferDeleter;
- std::vector<GLuint> pooledTextures;
+ std::vector<TextureID> pooledTextures;
- std::vector<GLuint> abandonedPrograms;
- std::vector<GLuint> abandonedShaders;
- std::vector<GLuint> abandonedBuffers;
- std::vector<GLuint> abandonedTextures;
- std::vector<GLuint> abandonedVertexArrays;
- std::vector<GLuint> abandonedFramebuffers;
+ std::vector<ProgramID> abandonedPrograms;
+ std::vector<ShaderID> abandonedShaders;
+ std::vector<BufferID> abandonedBuffers;
+ std::vector<TextureID> abandonedTextures;
+ std::vector<VertexArrayID> abandonedVertexArrays;
+ std::vector<FramebufferID> abandonedFramebuffers;
};
} // namespace gl