summaryrefslogtreecommitdiff
path: root/src/mbgl/shader/line_shader.cpp
blob: 684390815c0bafd3c635bb27b390669d683f6d1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <mbgl/shader/line_shader.hpp>
#include <mbgl/shader/line.vertex.hpp>
#include <mbgl/shader/line.fragment.hpp>
#include <mbgl/gl/gl.hpp>

namespace mbgl {

LineShader::LineShader(gl::Context& context, Defines defines)
    : Shader(shaders::line::name,
             shaders::line::vertex,
             shaders::line::fragment,
             context, defines) {
}

void LineShader::bind(int8_t* 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_data));
    MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_UNSIGNED_BYTE, false, 8, offset + 4));
}

} // namespace mbgl