[core] introduces types for GL objects

This commit is contained in:
Konstantin Käfer
2016-09-29 12:15:36 +02:00
committed by John Firebaugh
parent d1a84d9b51
commit 15aece8a30
15 changed files with 101 additions and 60 deletions

View File

@@ -3,6 +3,14 @@
namespace mbgl {
namespace gl {
static_assert(std::is_same<ProgramID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<ShaderID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<BufferID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<TextureID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<VertexArrayID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<FramebufferID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<RenderbufferID, GLuint>::value, "OpenGL type mismatch");
Context::~Context() {
reset();
}
@@ -60,7 +68,7 @@ void Context::setDirtyState() {
}
void Context::performCleanup() {
for (GLuint id : abandonedPrograms) {
for (auto id : abandonedPrograms) {
if (program == id) {
program.setDirty();
}
@@ -68,7 +76,7 @@ void Context::performCleanup() {
}
abandonedPrograms.clear();
for (GLuint id : abandonedShaders) {
for (auto id : abandonedShaders) {
MBGL_CHECK_ERROR(glDeleteShader(id));
}
abandonedShaders.clear();