fix rendering errors

This commit is contained in:
Konstantin Käfer
2014-12-11 11:58:46 +01:00
parent f8ba23377d
commit febfb7ac09
6 changed files with 33 additions and 31 deletions

View File

@@ -1,7 +1,6 @@
#include <mbgl/shader/linepattern_shader.hpp>
#include <mbgl/shader/shaders.hpp>
#include <mbgl/platform/gl.hpp>
#include <iostream>
#include <cstdio>
@@ -19,17 +18,13 @@ LinepatternShader::LinepatternShader()
}
a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_extrude = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_extrude"));
a_linesofar = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_linesofar"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
}
void LinepatternShader::bind(char *offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 8, offset + 0));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_extrude));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_extrude, 2, GL_BYTE, false, 8, offset + 4));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_linesofar));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_linesofar, 1, GL_SHORT, false, 8, offset + 6));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_BYTE, false, 8, offset + 4));
}